diff options
Diffstat (limited to 'unicode/plugins')
-rw-r--r-- | unicode/plugins/5000Points/Until5000.dpr | 106 | ||||
-rw-r--r-- | unicode/plugins/Blind/Blind.dpr | 107 | ||||
-rw-r--r-- | unicode/plugins/Don't_Get_Worse/Hold_The_Line.dpr | 222 | ||||
-rw-r--r-- | unicode/plugins/Duell/Duell.dpr | 44 | ||||
-rw-r--r-- | unicode/plugins/Makefile.in | 146 | ||||
-rw-r--r-- | unicode/plugins/README(Plugins Status).txt | 12 | ||||
-rw-r--r-- | unicode/plugins/SDK/Hooks.txt | 20 | ||||
-rw-r--r-- | unicode/plugins/SDK/ModiSDK.pas | 180 | ||||
-rw-r--r-- | unicode/plugins/SDK/Plugin DLL Exports.txt | 11 | ||||
-rw-r--r-- | unicode/plugins/SDK/Services.txt | 22 | ||||
-rw-r--r-- | unicode/plugins/SDK/StrUtils.pas | 79 | ||||
-rw-r--r-- | unicode/plugins/SDK/UPartyDefs.pas | 189 | ||||
-rw-r--r-- | unicode/plugins/SDK/UPluginDefs.pas | 193 | ||||
-rw-r--r-- | unicode/plugins/Team_Duell/TeamDuell.dpr | 337 |
14 files changed, 688 insertions, 980 deletions
diff --git a/unicode/plugins/5000Points/Until5000.dpr b/unicode/plugins/5000Points/Until5000.dpr index df79bfe2..83bc1007 100644 --- a/unicode/plugins/5000Points/Until5000.dpr +++ b/unicode/plugins/5000Points/Until5000.dpr @@ -7,81 +7,87 @@ library Until5000; uses ModiSDK in '..\SDK\ModiSDK.pas'; -//Gave the Plugins Info +// give the plugin's info procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin - Info.Name := 'PLUGIN_UNTIL5000_NAME'; + Info.Name := 'PLUGIN_UNTIL5000_NAME'; Info.Creator := 'Whiteshark'; Info.PluginDesc := 'PLUGIN_UNTIL5000_DESC'; - //Set to Party Modi Plugin - Info.Typ := 8; + // set to party modus plugin + 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 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 := True; //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 SoundData is available - Info.Dummy := False; //Should be Set to False... for Updateing 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 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 := true; // 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 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; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin -Result := True; + Result := true; end; -//Executed everytime the Screen is Drawed //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 drawn; if false the game finishes +function Draw (var Playerinfo: TPlayerinfo; + const CurSentence: cardinal) + : boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var -I: Integer; + Index: integer; begin -Result := False; - for I := 0 to PlayerInfo.NumPlayers-1 do + Result := false; + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Bar := PlayerInfo.Playerinfo[I].Score div 50; - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Bar; - if (PlayerInfo.Playerinfo[I].Score >=5000) then + PlayerInfo.Playerinfo[Index].Bar := PlayerInfo.Playerinfo[Index].Score div 50; + PlayerInfo.Playerinfo[Index].Percentage := PlayerInfo.Playerinfo[Index].Bar; + if (PlayerInfo.Playerinfo[Index].Score >= 5000) then Exit; end; -Result := True; + 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 - I:Integer; + Index: integer; begin -Result := 0; -for I := 0 to PlayerInfo.NumPlayers-1 do + Result := 0; + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - if (PlayerInfo.Playerinfo[I].Score >=5000) then + if (PlayerInfo.Playerinfo[Index].Score >= 5000) then begin - 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; + 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; end; end; end; diff --git a/unicode/plugins/Blind/Blind.dpr b/unicode/plugins/Blind/Blind.dpr index d2824587..3c68374c 100644 --- a/unicode/plugins/Blind/Blind.dpr +++ b/unicode/plugins/Blind/Blind.dpr @@ -7,72 +7,75 @@ library Blind; uses ModiSDK in '..\SDK\ModiSDK.pas'; -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; +// give the plugin's info +procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin - Info.Name := 'PLUGIN_BLIND_NAME'; - + Info.Name := 'PLUGIN_BLIND_NAME'; Info.Creator := 'Whiteshark'; Info.PluginDesc := 'PLUGIN_BLIND_DESC'; - //Set to Party Modi Plugin - Info.Typ := 8; + // set to party modus plugin + 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 := False; //Whether the Note Lines should be displayed - Info.LoadVideo := True; //Should the Video be loaded ? - Info.LoadBack := True; //Should the Background be loaded ? + // 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 := false; // 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.BGShowFull := false; // whether the background or the video should be shown in full size + Info.BGShowFull_O := true; // whether the background or the video should be shown in full size - Info.ShowRateBar:= False; //Whether the Bar that shows how good the player was sould be displayed - Info.ShowRateBar_O := True; //Load from Ini whether the Bar should be Displayed + Info.ShowRateBar := false; // whether the bar that shows how good the player was should be displayed + Info.ShowRateBar_O := true; // 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 + 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 SoundData is available - Info.Dummy := False; //Should be Set to False... for Updateing 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 := 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 -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; +// 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} begin -Result := True; + Result := true; end; -//Executed everytime the Screen is Drawed //If False The Game finishes -function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; -var -I: Integer; +// 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} begin -Result := True; + Result := true; end; -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +// is executed on finish, returns the player number of the winner +function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - I:Integer; - MaxScore: Word; + Index: integer; + MaxScore: word; begin - Result := 0; + Result := 0; MaxScore := 0; - for I := 0 to PlayerInfo.NumPlayers-1 do + for Index := 0 to PlayerInfo.NumPlayers - 1 do begin - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (PlayerInfo.Playerinfo[I].Score > MaxScore) then + PlayerInfo.Playerinfo[Index].Percentage := PlayerInfo.Playerinfo[Index].Score div 9999; + if (PlayerInfo.Playerinfo[Index].Score > MaxScore) then begin - MaxScore := PlayerInfo.Playerinfo[I].Score; - Case I of + MaxScore := PlayerInfo.Playerinfo[Index].Score; + case Index of 0: Result := 1; 1: Result := 2; 2: Result := 4; @@ -81,20 +84,20 @@ begin 5: Result := 32; end; end - else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].Score <> 0) then + else if (PlayerInfo.Playerinfo[Index].Score = MaxScore) and (PlayerInfo.Playerinfo[Index].Score <> 0) then begin - 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; + 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; end; end; end; - //If everybody has 0 Points nobody Wins - If (MaxScore = 0) then + // if everybody has 0 points nobody wins + if (MaxScore = 0) then Result := 0; end; diff --git a/unicode/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/unicode/plugins/Don't_Get_Worse/Hold_The_Line.dpr index 8bfb292c..a7828f8e 100644 --- a/unicode/plugins/Don't_Get_Worse/Hold_The_Line.dpr +++ b/unicode/plugins/Don't_Get_Worse/Hold_The_Line.dpr @@ -5,67 +5,74 @@ library Hold_The_Line; {$ENDIF} uses - 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, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; var - PointerTex: TSmallTexture; - CountSentences: Cardinal; - Limit: Byte; - MethodRec: TMethodRec; - Frame: Integer; - PlayerTimes: array[0..5] of Integer; - LastTick: Cardinal; - PointerVisible: Boolean; - - DismissedSound: Cardinal; - -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; + PointerTex: TSmallTexture; + CountSentences: cardinal; + Limit: byte; + MethodRec: TMethodRec; +// Frame: integer; + PlayerTimes: array[0..5] of integer; + LastTick: cardinal; + PointerVisible: boolean; + + DismissedSound: cardinal; + +// Give the plugin's info +procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin - Info.Name := 'PLUGIN_HDL_NAME'; + Info.Name := 'PLUGIN_HDL_NAME'; Info.Creator := 'Whiteshark'; Info.PluginDesc := 'PLUGIN_HDL_DESC'; - //Set to Party Modi Plugin - Info.Typ := 8; + // Set to Party Modi Plugin + 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 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 := False; //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 + // 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 := 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 -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; +// 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} + +const + TextureName : PChar = 'HDL_Pointer'; + SoundName : PChar = 'dismissed.mp3'; var - I: Integer; - Texname: PChar; + Index: integer; +// Texname: PChar; TexType: TTextureType; begin +{ TexName := CreateStr(PChar('HDL_Pointer')); TexType := TEXTURE_TYPE_TRANSPARENT; PointerTex := Methods.LoadTex(TexName, TexType); @@ -75,50 +82,56 @@ begin TexName := CreateStr(PChar('dismissed.mp3')); DismissedSound := Methods.LoadSound (TexName); FreeStr(TexName); +} + TexType := TEXTURE_TYPE_TRANSPARENT; + PointerTex := Methods.LoadTex(TextureName, TexType); + + DismissedSound := Methods.LoadSound (SoundName); CountSentences := Sentences.High; Limit := 0; - Frame := 0; +// Frame := 0; MethodRec := Methods; - for I := 0 to PlayerInfo.NumPlayers-1 do + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Enabled := True; - PlayerInfo.Playerinfo[I].Percentage := 100; - PlayerTimes[I] := 0; + PlayerInfo.Playerinfo[Index].Enabled := true; + PlayerInfo.Playerinfo[Index].Percentage := 100; + PlayerTimes[Index] := 0; end; - Result := True; + Result := true; end; -//Executed everytime the Screen is Drawed //If False The Game finishes -function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; +function Draw (var Playerinfo: TPlayerinfo; + const CurSentence: cardinal) + : boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +const + SoundName : PChar = 'PARTY_DISMISSED'; var - I: Integer; - L: Byte; - C: Byte; - Text: PChar; - Blink: Boolean; - tick: Cardinal; + Index: integer; + L: byte; + C: byte; + Tick: cardinal; begin - //Aktivate Blink - If (CurSentence = CountSentences div 5 * 2 - 1) OR (CurSentence = CountSentences div 3 * 2 - 1) then + // activate blink + if (CurSentence = CountSentences div 5 * 2 - 1) or (CurSentence = CountSentences div 3 * 2 - 1) then begin - Tick := SDL_GetTicks() div 400; - If (Tick <> LastTick) then + Tick := round(TimeStampToMSecs(DateTimeToTimeStamp(Now))) div 400; + if (Tick <> LastTick) then begin LastTick := Tick; - PointerVisible := Not PointerVisible; + PointerVisible := not PointerVisible; end; end else - PointerVisible := True; + PointerVisible := true; - //Inc Limit - if (Limit = 0) And (CurSentence >= CountSentences div 5 * 2) then + // inc limit + if (Limit = 0) and (CurSentence >= CountSentences div 5 * 2) then Inc(Limit) - else if (Limit = 1) And (CurSentence >= CountSentences div 3 * 2) then + else if (Limit = 1) and (CurSentence >= CountSentences div 3 * 2) then Inc(Limit); case Limit of @@ -129,22 +142,22 @@ begin C:= 0; - Result := True; + Result := true; - for I := 0 to PlayerInfo.NumPlayers-1 do + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - if PlayerInfo.Playerinfo[I].Enabled then + if PlayerInfo.Playerinfo[Index].Enabled then begin - if PlayerInfo.Playerinfo[I].Bar < L then + if PlayerInfo.Playerinfo[Index].Bar < L then begin - PlayerInfo.Playerinfo[I].Enabled := False; + PlayerInfo.Playerinfo[Index].Enabled := false; Inc(C); - PlayerTimes[I] := CurSentence; //Save Time of Dismission - //PlaySound + PlayerTimes[Index] := CurSentence; // Save Time of Dismission + // PlaySound MethodRec.PlaySound (DismissedSound); end; - //Draw Pointer + // Draw pointer if (PointerVisible) then begin glColor4f (0.2, 0.8, 0.1, 1); @@ -156,10 +169,10 @@ begin glBindTexture(GL_TEXTURE_2D, PointerTex.TexNum); glBegin(GL_QUADS); - glTexCoord2f(1/32, 0); glVertex2f(PlayerInfo.Playerinfo[I].PosX + L - 3, PlayerInfo.Playerinfo[I].PosY - 4); - glTexCoord2f(1/32, 1); glVertex2f(PlayerInfo.Playerinfo[I].PosX + L - 3, PlayerInfo.Playerinfo[I].PosY + 12); - glTexCoord2f(31/32, 1); glVertex2f(PlayerInfo.Playerinfo[I].PosX+ L + 3, PlayerInfo.Playerinfo[I].PosY + 12); - glTexCoord2f(31/32, 0); glVertex2f(PlayerInfo.Playerinfo[I].PosX+ L + 3, PlayerInfo.Playerinfo[I].PosY - 4); + glTexCoord2f(1/32, 0); glVertex2f(PlayerInfo.Playerinfo[Index].PosX + L - 3, PlayerInfo.Playerinfo[Index].PosY - 4); + glTexCoord2f(1/32, 1); glVertex2f(PlayerInfo.Playerinfo[Index].PosX + L - 3, PlayerInfo.Playerinfo[Index].PosY + 12); + glTexCoord2f(31/32, 1); glVertex2f(PlayerInfo.Playerinfo[Index].PosX+ L + 3, PlayerInfo.Playerinfo[Index].PosY + 12); + glTexCoord2f(31/32, 0); glVertex2f(PlayerInfo.Playerinfo[Index].PosX+ L + 3, PlayerInfo.Playerinfo[Index].PosY - 4); glEnd; glDisable(GL_TEXTURE_2D); @@ -170,45 +183,44 @@ begin else begin Inc(C); - //Draw Dismissed - Text := CreateStr(PChar('PARTY_DISMISSED')); - + // Draw dismissed glColor4f (0.8, 0.8, 0.8, 1); - - MethodRec.Print (1, 18, PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY-8, Text); - FreeStr(Text); + MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY-8, SoundName); end; end; if (C >= PlayerInfo.NumPlayers-1) then - Result := False; + Result := false; end; -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +// is executed on finish, returns the player number of the winner +function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - I:Integer; + Index: integer; begin -Result := 0; -for I := 0 to PlayerInfo.NumPlayers-1 do + Result := 0; + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Percentage := (PlayerTimes[I] * 100) div CountSentences; - if (PlayerInfo.Playerinfo[I].Enabled) then + PlayerInfo.Playerinfo[Index].Percentage := (PlayerTimes[Index] * 100) div CountSentences; + if (PlayerInfo.Playerinfo[Index].Enabled) then begin - PlayerInfo.Playerinfo[I].Percentage := 100; - 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; + PlayerInfo.Playerinfo[Index].Percentage := 100; + 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; end; end; end; end; exports -PluginInfo, Init, Draw, Finish; + PluginInfo, + Init, + Draw, + Finish; begin diff --git a/unicode/plugins/Duell/Duell.dpr b/unicode/plugins/Duell/Duell.dpr index 93c87d0e..f54edea8 100644 --- a/unicode/plugins/Duell/Duell.dpr +++ b/unicode/plugins/Duell/Duell.dpr @@ -8,56 +8,56 @@ uses ModiSDK in '..\SDK\ModiSDK.pas'; //Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; +procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin - Info.Name := 'PLUGIN_DUELL_NAME'; + Info.Name := 'PLUGIN_DUELL_NAME'; Info.Creator := 'Whiteshark'; Info.PluginDesc := 'PLUGIN_DUELL_DESC'; - Info.Typ := 8; + Info.Typ := 8; Info.NumPlayers := 31; //Options - Info.LoadSong := True; //Whether or not a Song should 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.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.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:= False; //Whether the Bar that shows how good the player was sould be displayed + Info.ShowRateBar := False; //Whether the Bar that shows how good the player was sould be displayed Info.ShowRateBar_O := True; //Load from Ini whether the Bar should be Displayed - Info.EnLineBonus := False; //Whether LineBonus Should be enabled + 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 SoundData is available - Info.Dummy := False; //Should be Set to False... for Updateing Plugin Interface + 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 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; stdcall; +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin -Result := True; + Result := True; end; //Executed everytime the Screen is Drawed //If False The Game finishes -function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; +function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin -Result := True; + Result := True; end; //Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - I:Integer; + I: Integer; MaxScore: Word; begin Result := 0; diff --git a/unicode/plugins/Makefile.in b/unicode/plugins/Makefile.in new file mode 100644 index 00000000..0fc49745 --- /dev/null +++ b/unicode/plugins/Makefile.in @@ -0,0 +1,146 @@ +################################################# +# @PACKAGE_STRING@ +# @configure_input@ +################################################# + +@SET_MAKE@ +SHELL = /bin/sh + +################################################# +# Standard definitions +################################################# + +top_srcdir ?= @top_srcdir@ +srcdir ?= @srcdir@ + +################################################# +# Tools +################################################# + +RM ?= rm -f + +################################################# +# USDX Paths +################################################# + +USDX_SRC_DIR := $(top_srcdir)/src +USDX_BUILD_DIR := $(top_srcdir)/build +USDX_LIB_DIR := $(USDX_SRC_DIR)/lib + +################################################# +# FPC config +################################################# + +# Free Pascal compiler binary +PPC := @PPC@ +# FPC target platform and processor +PPLATFORM := @FPC_PLATFORM@ +PPROCESSOR := @FPC_PROCESSOR@ + +# Directories added to the unit path +PUNIT_FLAGS := -FE../game/plugins -Fu../build/fpc-$(PPROCESSOR)-$(PPLATFORM) + +# Directory where compiled units (.ppu, .o and library files) are stored +PCUNIT_DIR := $(USDX_BUILD_DIR)/fpc-$(PPROCESSOR)-$(PPLATFORM) +PCUNIT_FLAGS := -FU$(PCUNIT_DIR) + +## +# PFLAGS +## + +# Defined on debug mode +ENABLE_DEBUG := @ENABLE_DEBUG@ + +# Note: +# - PFLAGS/PFLAGS_* defaults to $(PFLAGS_XYZ_DEFAULT) if not set by the user +# - if PFLAGS is defined, PFLAGS_* will be ignored on "make all" +PFLAGS ?= @PFLAGS@ +PFLAGS_BASE ?= @PFLAGS_BASE@ +PFLAGS_DEBUG ?= @PFLAGS_DEBUG@ +PFLAGS_RELEASE ?= @PFLAGS_RELEASE@ + +# Do not overwrite, just add extra flags +PFLAGS_EXTRA += @PFLAGS_EXTRA@ + +# Default PFLAGS, used if PFLAGS/PFLAGS_* was not set by the user +# - Do not use -dDEBUG because it will enable unwanted features +# - Do not strip executable (-Xs, set by fpc.cfg) to be GNU make conformant +# - Use DEBUG_MODE instead of DEBUG to avoid enabling the fpc.cfg DEBUG preset +# - The flag -vB appends the full path to filenames +# - Note that fpc.cfg already defines -vinw, so add -v0 first +# - The stack check (-Ct) might not work with enabled threading +# - Do we need -Coi? +PFLAGS_BASE_DEFAULT := -Si -Sg- -Sc- -v0Binwe +PFLAGS_DEBUG_DEFAULT := -Xs- -g -gl -dDEBUG_MODE +PFLAGS_RELEASE_DEFAULT := -Xs- -O2 +PFLAGS_EXTRA_DEFAULT := + +# Debug/Release mode flags +# Note that flags will overwrite previously specified flags, +# e.g. "-vinwe -vi-" is the same as "-vnwe" +PFLAGS_DEBUG_ALL := $(PFLAGS_BASE) $(PFLAGS_DEBUG) $(PFLAGS_EXTRA) +PFLAGS_RELEASE_ALL := $(PFLAGS_BASE) $(PFLAGS_RELEASE) $(PFLAGS_EXTRA) + +# Choose default PFLAGS, depending on debug mode. +# Only used if PFLAGS was not set by the user. +ifdef ENABLE_DEBUG +PFLAGS_DEFAULT := $(PFLAGS_DEBUG_ALL) +else +PFLAGS_DEFAULT := $(PFLAGS_RELEASE_ALL) +endif + +PFLAGS_ALL = $(PFLAGS) $(PDEFINES) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS) + +.PHONY: all +all: SDK 5000Points Blind Dont_Get_Worse Duell Team_Duell + +.PHONY: SDK +SDK: clean-SDK + $(PPC) $(strip $(PFLAGS_ALL)) SDK/ModiSDK.pas + +.PHONY: 5000Points +5000Points: SDK clean-5000Points + $(PPC) $(strip $(PFLAGS_ALL)) 5000Points/Until5000.dpr + +.PHONY: Blind +Blind: SDK clean-Blind + $(PPC) $(strip $(PFLAGS_ALL)) Blind/Blind.dpr + +.PHONY: Duell +Duell: SDK clean-Duell + $(PPC) $(strip $(PFLAGS_ALL)) Duell/Duell.dpr + +.PHONY: Team_Duell +Team_Duell: SDK clean-Team_Duell + $(PPC) $(strip $(PFLAGS_ALL)) Team_Duell/TeamDuell.dpr + +.PHONY: Dont_Get_Worse +Dont_Get_Worse: SDK clean-Dont_Get_Worse + $(PPC) $(strip $(PFLAGS_ALL)) Don\'t_Get_Worse/Hold_The_Line.dpr + +.PHONY: clean-plugins +clean-plugins: clean-SDK clean-5000Points clean-Blind clean-Dont_Get_Worse clean-Duell clean-Team_Duell + +.PHONY: clean-SDK +clean-SDK: + $(RM) $(PCUNIT_DIR)/ModiSDK.o $(PCUNIT_DIR)/ModiSDK.ppu + +.PHONY: clean-5000Points +clean-5000Points: + $(RM) $(PCUNIT_DIR)/Until5000.o $(PCUNIT_DIR)/libUntil5000.* + +.PHONY: clean-Blind +clean-Blind: + $(RM) $(PCUNIT_DIR)/Blind.o $(PCUNIT_DIR)/libBlind.* + +.PHONY: clean-Duell +clean-Duell: + $(RM) $(PCUNIT_DIR)/Duell.o $(PCUNIT_DIR)/libDuell.* + +.PHONY: clean-Team_Duell +clean-Team_Duell: + $(RM) $(PCUNIT_DIR)/TeamDuell.o $(PCUNIT_DIR)/libTeamDuell.* + +.PHONY: clean-Dont_Get_Worse +clean-Dont_Get_Worse: + $(RM) $(PCUNIT_DIR)/Hold_The_Line.o $(PCUNIT_DIR)/libHold_The_Line.* diff --git a/unicode/plugins/README(Plugins Status).txt b/unicode/plugins/README(Plugins Status).txt new file mode 100644 index 00000000..a6756832 --- /dev/null +++ b/unicode/plugins/README(Plugins Status).txt @@ -0,0 +1,12 @@ +All plugins are cleared off the SDL stuff (basically SDL_GetTicks), the StrUtils and moduleloader unit and should work on all platforms. +2009-May-23 KMS + +Mac OS X: +The following plugins can be compiled and used after being put in to the plugins folder: Blind, 5000Points, Duell + +2009-Apr-8 KMS + +The plugins are currently disabled until the party mode is working again. +This applies to all platforms supported (Windows, Linux, Mac OS X, FreeBSD). + +2009-Jan-20 Karl-Michael Schindler aka Mischi. diff --git a/unicode/plugins/SDK/Hooks.txt b/unicode/plugins/SDK/Hooks.txt deleted file mode 100644 index 999f552f..00000000 --- a/unicode/plugins/SDK/Hooks.txt +++ /dev/null @@ -1,20 +0,0 @@ -Ultrastar Deluxe Hook List ------------------------------------ -Here you can find the Events the Core offers to you: - --------------------- -Core: --------------------- -Core/LoadingFinished <- Hook is called after all Modules and Plugins are loaded completely, before MainLoop -Core/MainLoop <- Hook is called once in MainLoop before Drawing -Core/Translate <- Hook is called when Strings should be translated. If this is Retranslating lParam is Non Zero -Core/LoadTextures <- Hook is called when Textures should be Loaded. This will be called in Ogl Thread. If Textures are Reloaded (e.g. on Display ReInit) LParam is non Zero. -Core/ExitQuery <- Hook is called if someone querys an exit. (e.g. X is pressed). Not called on ForcedExit. If Chain is breaked the exit will be aborted. -Core/Exit <- Hook is called before Module a. Plugin unload. -Core/NewDebugInfo <- Hook is called everytime there is Debug Info to Output(only if Debug Mode is enabled). wParam: Pchar(Message), lParam: PChar(Reportername) -Core/NewError <- Hook is called everytime an error is reported. wParam: Pchar(Message), lParam: PChar(Reportername) - --------------------- -Display --------------------- -Display/onScreenChange <-Hook is called when there is an attemp to change Screen. wParam is address to Screens Name(Null Terminated). If Chain is breaked Screenchange will be aborted.
\ No newline at end of file diff --git a/unicode/plugins/SDK/ModiSDK.pas b/unicode/plugins/SDK/ModiSDK.pas index c0e66387..e0b52a81 100644 --- a/unicode/plugins/SDK/ModiSDK.pas +++ b/unicode/plugins/SDK/ModiSDK.pas @@ -6,94 +6,93 @@ interface {$MODE Delphi} {$ENDIF} -type //PluginInfo, for Init +type // PluginInfo, for init TPluginInfo = record - //Info - Name : Array [0..32] of Char; //Modi to Register for the Plugin - Creator : Array [0..32] of Char; //Name of the Author - PluginDesc : Array [0..64] of Char; //Plugin Description + // Info + Name: array [0..32] of char; // modus to register for the plugin + Creator: array [0..32] of char; // name of the author + PluginDesc: array [0..64] of char; // plugin description - //Plugin Typ, atm: 8 only for PartyMode Modi + // plugin type, atm: 8 only for partymode modus Case Typ: byte of 8: ( - //Options - LoadSong: boolean; //Whether or not a Song should be Loaded - //Only When Song is Loaded: - ShowNotes: boolean; //Whether the Note Lines should be displayed - LoadVideo: boolean; //Should the Video be loaded ? - LoadBack: boolean; //Should the Background be loaded ? - - ShowRateBar: boolean; //Whether the Bar that shows how good the player was sould be displayed - ShowRateBar_O: boolean; //Load from Ini whether the Bar should be Displayed - - EnLineBonus: boolean; //Whether LineBonus Should be enabled - EnLineBonus_O: boolean; //Load from Ini whether LineBonus Should be enabled - - BGShowFull: boolean; //Whether the Background or the Video should be shown Fullsize - BGShowFull_O: boolean; //Whether the Background or the Video should be shown Fullsize - - //Options -> everytime - ShowScore: boolean; //Whether or not the Score should be shown - ShowBars: boolean; //Whether the White Bars on Top and Bottom should be Drawn - TeamModeOnly: boolean; //If True the Plugin can only be Played in Team Mode - GetSoundData: boolean; //If True the RData Procedure is called when new SoundData is available - Dummy: boolean; //Should be Set to False... for Updateing Plugin Interface - - NumPlayers: Byte //Number of Available Players for Modi - //Set different Bits - //1 -> One Player - //2 -> Two Players - //4 -> Three Players - //8 -> Four Players - //16-> Six Players - //e.g. : 10 -> Playable with 2 and 4 Players + // Options + LoadSong: boolean; // Whether or not a song should be loaded + // Only when song is loaded: + ShowNotes: boolean; // Whether the note lines should be displayed + LoadVideo: boolean; // Should the video be loaded? + LoadBack: boolean; // Should the background be loaded? + + ShowRateBar: boolean; // Whether the bar that shows how good the player was sould be displayed + ShowRateBar_O: boolean; // Load from ini whether the bar should be displayed + + EnLineBonus: boolean; // Whether line bonus should be enabled + EnLineBonus_O: boolean; // Load from ini whether line bonus should be enabled + + BGShowFull: boolean; // Whether the background or the video should be shown full size + BGShowFull_O: boolean; // Whether the background or the video should be shown full size + + // Options -> everytime + ShowScore: boolean; // Whether or not the score should be shown + ShowBars: boolean; // Whether the white bars on top and bottom should be drawn + TeamModeOnly: boolean; // If true the plugin can only be played in team mode + GetSoundData: boolean; // If true the rdata procedure is called when new sound data is available + Dummy: boolean; // Should be set to false... for updating plugin interface + + NumPlayers: byte // Number of available players for modus + // Set different bits + // 1 -> one player + // 2 -> two players + // 4 -> three players + // 8 -> four players + // 16-> six players + // e.g. : 10 -> playable with 2 and 4 players ); end; TPlayerInfo = record - NumPlayers: Byte; + NumPlayers: byte; Playerinfo: array[0..5] of record - Name: PChar; //Name of the Player - Score:Word; //Players Score - Bar: Byte; //Percentage of the SingBar filled - PosX: Real; //PosX of Players SingBar - PosY: Real; //PosY " - Enabled: Boolean; //Whether the Player could get Points - Percentage: Byte; //Percentage Shown on the Score Screen + Name: PChar; // Name of the player + Score: word; // Player's score + Bar: byte; // Percentage of the singbar filled + PosX: real; // PosX of player's singbar + PosY: real; // PosY " + Enabled: boolean; // Whether the player could get points + Percentage: byte; // Percentage shown on the score screen end; end; TTeamInfo = record - NumTeams: Byte; + NumTeams: byte; Teaminfo: array[0..5] of record - Name: PChar; - Score: Word; - Joker: Byte; - CurPlayer: Byte; - NumPlayers: Byte; + Name: PChar; + Score: word; + Joker: byte; + CurPlayer: byte; + NumPlayers: byte; Playerinfo: array[0..3] of record - Name: PChar; - TimesPlayed: Byte; - + Name: PChar; + TimesPlayed: byte; end; end; end; TsmallTexture = record - TexNum: integer; - W: real; - H: real; + TexNum: integer; + W: real; + H: real; end; TSentences = record - Current: integer; // aktualna czesc utworu do rysowania - High: integer; - Number: integer; - Resolution: integer; - NotesGAP: integer; - TotalLength:integer; - Sentence: array of record + Current: integer; // current part of a line + High: integer; + Number: integer; + Resolution: integer; + NotesGAP: integer; + TotalLength: integer; + Sentence: array of record Start: integer; StartNote: integer; Lyric: string; @@ -109,14 +108,14 @@ type //PluginInfo, for Init Length: integer; Tone: integer; //Text: string; - FreeStyle: boolean; - Typ: integer; // zwykla nuta x1, zlota nuta x2 + FreeStyle: boolean; + Typ: integer; // normal note x1, golden note x2 end; end; end; - DWORD = Longword; - HSTREAM = DWORD; + dword = longword; + hstream = dword; TTextureType = ( TEXTURE_TYPE_PLAIN, // Plain (alpha = 1) @@ -124,12 +123,18 @@ type //PluginInfo, for Init TEXTURE_TYPE_COLORIZED // Alpha is used; Hue of the HSV color-model will be replaced by a new value ); - //Routines to gave to the Plugin - fModi_LoadTex = function (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; //Pointer to Texture Loader - //fModi_Translate = function (const Name, Translation: AChar): Integer; stdcall; //Pointer to Translator - fModi_Print = procedure (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text //Now translated automatically - fModi_LoadSound = function (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound - pModi_PlaySound = procedure (const Index: Cardinal); stdcall; //Plays a Custom Sound + // Routines to give to the plugin + fModi_LoadTex = function (const Name: PChar; Typ: TTextureType): TsmallTexture; // Pointer to texture loader + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + //fModi_Translate = function (const Name, Translation: AChar): integer; // Pointer to translator + // {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + + fModi_Print = procedure (const Style, Size: byte; const X, Y: real; const Text: PChar); // Procedure to print text // Now translated automatically + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + fModi_LoadSound = function (const Name: PChar): cardinal; // Procedure that loads a custom sound + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + pModi_PlaySound = procedure (const Index: cardinal); // Plays a custom sound + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} TMethodRec = record LoadTex: fModi_LoadTex; @@ -137,17 +142,22 @@ type //PluginInfo, for Init LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound; end; - //DLL Funktionen - //Gave the Plugins Info - pModi_PluginInfo = procedure (var Info: TPluginInfo); stdcall; - //Executed on Game Start //If True Game begins, else Failure - fModi_Init = function (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; - //Executed everytime the Screen is Drawed //If False The Game finishes - fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; - //Is Executed on Finish, Returns the Playernum of the Winner - fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; stdcall; - //Procedure called when new Sound Data is available - pModi_RData = procedure (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); stdcall; + // DLL functions + // Give the plugins info + pModi_PluginInfo = procedure (var Info: TPluginInfo); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + // Executed on game start // if true game begins, else failure + fModi_Init = function (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + // Executed everytime the screen is drawn // if false the game finishes + fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + // Is executed on finish, returns the player num of the winner + fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + // Procedure called when new sound data is available + pModi_RData = procedure (handle: hstream; buffer: pointer; len: dword; user: dword); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} implementation diff --git a/unicode/plugins/SDK/Plugin DLL Exports.txt b/unicode/plugins/SDK/Plugin DLL Exports.txt deleted file mode 100644 index 930e18ac..00000000 --- a/unicode/plugins/SDK/Plugin DLL Exports.txt +++ /dev/null @@ -1,11 +0,0 @@ -Ultrastar Plugin DLL(Libary) Exports ------------------------------------ -This are the Procedurs and Functions that a UsDx Plugin has to export to get Loaded. - - -USPlugin_Info(PInfo: PUS_PluginInfo); stdcall; ------------------------------------ -Ultrastar uses this Procedure to identify the Plugins. -At the given Address there is a PUS_PluginInfo Record. cbSize -attribut is already set. Please asure not to overwrite this assigned -memory amount. diff --git a/unicode/plugins/SDK/Services.txt b/unicode/plugins/SDK/Services.txt deleted file mode 100644 index 8db031d8..00000000 --- a/unicode/plugins/SDK/Services.txt +++ /dev/null @@ -1,22 +0,0 @@ -Ultrastar Deluxe Service List ------------------------------------ -Here you can find the Services the Core offers to you: - --------------------- -Core: --------------------- -Core/ReportError <- Calls the 'Core/NewError' Chain. wParam: Pchar(Message), lParam: PChar(Reportername) -Core/ReportDebug <- Calls the 'Core/NewDebugInfo' Chain. wParam: Pchar(Message), lParam: PChar(Reportername) -Core/ShowMessage <- Shows a Message Dialog. (lParam: PChar Text, wParam: Symbol) -Core/Retranslate <- Calls Translate Hook -Core/ReloadTextures <- Calls LoadTextures Hook -Core/GetModuleInfo <- If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TModuleInfo to address at lparam -Core/GetApplicationHandle <- Returns Main-Applications Handle (Win32 Only) - --------------------- -PluginLoader --------------------- -PluginLoader/GetPluginInfo <- If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam) -PluginLoader/GetPluginState <- If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) Else (Return PluginInfo of Plugin with Index(wParam)) -PluginLoader/LoadPlugin <- wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin -PluginLoader/UnloadPlugin <- wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin
\ No newline at end of file diff --git a/unicode/plugins/SDK/StrUtils.pas b/unicode/plugins/SDK/StrUtils.pas deleted file mode 100644 index 069c89c3..00000000 --- a/unicode/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/unicode/plugins/SDK/UPartyDefs.pas b/unicode/plugins/SDK/UPartyDefs.pas deleted file mode 100644 index 09f97812..00000000 --- a/unicode/plugins/SDK/UPartyDefs.pas +++ /dev/null @@ -1,189 +0,0 @@ -unit UPartyDefs; -{********************* - uPluginDefs - Some Basic Structures and Functions used to communicate with Plugins - Usable as Delphi Plugin SDK -*********************} - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses UPluginDefs; - -type - //---------------- - // TUS_Party_Proc_Init - Structure of the Party Init Proc - // This Function is called on SingScreen Init Everytime this Modi should be sung - // Return Non Zero to Abort Party Modi Loading... In this Case another Plugin will be loaded - //---------------- - TUS_Party_Proc_Init = Function (ID: Integer): integer; stdcall; - - //---------------- - // TUS_Party_Proc_Draw - Structure of the Party Draw Proc - // This Function is called on SingScreen Draw (Not when Paused). You should draw in this Proc - // Return Non Zero to Finish Song... In this Case Score Screen is loaded - //---------------- - TUS_Party_Proc_Draw = Function (ID: Integer): integer; stdcall; - - //---------------- - // TUS_Party_Proc_DeInit - Structure of the Party DeInit Proc - // This Function is called on SingScreen DeInit When Plugin abort Song or Song finishes - // Return Winner - //---------------- - TUS_Party_Proc_DeInit = Function (ID: Integer): integer; stdcall; - - //---------------- - // TUS_ModiInfo - Some Infos from Plugin to Partymode. - // Used to register party modi to Party manager - // --- - // Version Structure: - // First Byte: Head Revison - // Second Byte: Sub Revison - // Third Byte: Sub Revision 2 - // Fourth Byte: Letter (For Bug Fix releases. 0 or 'a' .. 'z') - //---------------- - TModiInfo_Name = Array [0..31] of Char; - TModiInfo_Desc = Array [0..63] of Char; - - PUS_ModiInfo = ^TUS_ModiInfo; - TUS_ModiInfo = record - //Size of this record (usefull if record will be extended in the future) - cbSize: Integer; //Don't forget to set this as Plugin! - - //Infos about the Modi - Name : TModiInfo_Name; //Modiname to Register for the Plugin - Description: TModiInfo_Desc; //Plugin Description - - //------------ - // Loading Settings - // --- - // Bit to Set | Triggered Option - // 1 | Song should be loaded - // 2 | Song has to be Non Duett - // 4 | Song has to be Duett (If 2 and 4 is set, both will be ignored) - // 8 | Only Playable with 2 and more players - // 16 | Restrict Background Loading - // 32 | Restrict Video Loading - // 64 | Increase TimesPlayed for Cur. Player - // 128 | Not in Use, Don't set it! - LoadingSettings: Byte; - - // SingScreen Settings - // --- - // Bit to Set | Triggered Option - // 1 | ShowNotes - // 2 | ShowScores - // 4 | ShowTime - // 8 | Start Audio Playback automaticaly - // 16 | Not in Use, Don't set it! - // 32 | Not in Use, Don't set it! - // 64 | Not in Use, Don't set it! - // 128 | Not in Use, Don't set it! - SingScreenSettings: Byte; - - // With which count of players can this modi be played - // --- - //Set different Bits - //1 -> One Player - //2 -> Two Players - //4 -> Three Players - //8 -> Four Players - //16-> Six Players - //e.g. : 10 -> Playable with 2 and 4 Players - NumPlayers: Byte; - - // ID that is given to the Party Procs when they are called - // If this Modi is running - // (e.g. to register Until 2000 and Until 5000 with the same Procs - // ID is the Max Point Count in this example) - ID: Integer; - - // Party Procs called on Party - // --- - // Set to nil(C: NULL) if u don't want to use this method - ModiInit: TUS_Party_Proc_Init; - ModiDraw: TUS_Party_Proc_Draw; - ModiDeInit: TUS_Party_Proc_DeInit; - end; - - //-------------- - // Team Info Record. Used by "Party/GetTeamInfo" and "Party/SetTeamInfo" - //-------------- - TTeamInfo = record - NumTeams: Byte; - Teaminfo: array[0..5] of record - Name: PChar; //Teamname - Score: Word; //TeamScore - Joker: Byte; //Team Jokers available - CurPlayer: Byte; //Id of Cur. Playing Player - NumPlayers: Byte; - Playerinfo: array[0..3] of record - Name: PChar; //Playername - TimesPlayed: Byte; //How often this Player has Sung - end; - end; - end; - -//---------------- -// Some Default Constants -//---------------- -const - // to use for TUS_ModiInfo.LoadingSettings - MLS_LoadSong = 1; //Song should be loaded - MLS_NotDuett = 2; //Song has to be Non Duett - MLS_ForceDuett = 4; //Song has to be Duett (If 2 and 4 is set, both will be ignored) - MLS_TeamOnly = 8; //Only Playable with 2 and more players - MLS_RestrictBG = 16; //Restrict Background Loading - MLS_RestrictVid = 32; //Restrict Video Loading - MLS_IncTP = 64; //Increase TimesPlayed for Cur. Player - - // to use with TUS_ModiInfo.SingScreenSettings - MSS_ShowNotes = 1; //ShowNotes - MSS_ShowScores = 2; //ShowScores - MSS_ShowTime = 4; //ShowTime - MSS_AutoPlayback= 8; //Start Audio Playback automaticaly - - //Standard (Duell) for TUS_ModiInfo.LoadingSettings and TUS_ModiInfo.SingScreenSettings - MLS_Standard = MLS_LoadSong or MLS_IncTP; - MSS_Standard = MSS_ShowNotes or MSS_ShowScores or MSS_ShowTime or MSS_AutoPlayback; - -//------------- -// Some helper functions to register Party Modi -//------------- -Function RegisterModi(const PluginInterface: PUS_PluginInterface; const Name: TModiInfo_Name; const Description: TModiInfo_Desc; const LoadingSettings, SingScreenSettings, NumPlayers: Byte; const ID: Integer; const ModiInit: TUS_Party_Proc_Init = nil; const ModiDeInit: TUS_Party_Proc_DeInit = nil; const ModiDraw: TUS_Party_Proc_Draw = nil): THandle; - - - -implementation - -//------------- -// Function that Prepares the ModiInfo Record and Calls Party/RegisterModi -//------------- -Function RegisterModi(const PluginInterface: PUS_PluginInterface; const Name: TModiInfo_Name; const Description: TModiInfo_Desc; const LoadingSettings, SingScreenSettings, NumPlayers: Byte; const ID: Integer; const ModiInit: TUS_Party_Proc_Init; const ModiDeInit: TUS_Party_Proc_DeInit; const ModiDraw: TUS_Party_Proc_Draw): THandle; -var - ModiInfo: TUS_ModiInfo; -begin - //Init Record - ModiInfo.cbSize := SizeOf(TUS_ModiInfo); - - ModiInfo.Name := Name; - ModiInfo.Description := Description; - ModiInfo.LoadingSettings := LoadingSettings; - ModiInfo.SingScreenSettings := SingScreenSettings; - ModiInfo.NumPlayers := NumPlayers; - - ModiInfo.ID := ID; - ModiInfo.ModiInit := ModiInit; - ModiInfo.ModiDraw := ModiDraw; - ModiInfo.ModiDeInit := ModiDeInit; - - //Call Service - Result := PluginInterface.CallService('Party/RegisterModi', Integer(@ModiInfo), nil); -end; - -end.
\ No newline at end of file diff --git a/unicode/plugins/SDK/UPluginDefs.pas b/unicode/plugins/SDK/UPluginDefs.pas deleted file mode 100644 index 45bae864..00000000 --- a/unicode/plugins/SDK/UPluginDefs.pas +++ /dev/null @@ -1,193 +0,0 @@ -unit uPluginDefs; -{********************* - uPluginDefs - Some basic structures and functions used to communicate with plugins - Usable as Delphi plugin SDK -*********************} - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -type - dword = LongWord; - - //Compatibility with 64 Bit Systems - {$IFDEF CPU32} - TwParam = integer; - TlParam = pointer; //lParam is used for 32 bit addresses. dword is large enough - {$ELSE} - TwParam = int64; - TlParam = pointer; //lParam used for 64 bit addresses in 64 bit systems (FreePascal) - {$ENDIF} - //wParam is mainly used for ordinals - //lparam is mainly used for pointers - - //---------------- - // TUS_PluginInfo - some infos from plugin to core. - // Send when Plugininfo procedure is called - // --- - // Version structure: - // First byte: Head Revison - // Second byte: Sub Revison - // Third byte: Sub Revision 2 - // Fourth byte: Letter (For Bug Fix releases. 0 or 'a' .. 'z') - //---------------- - PUS_PluginInfo = ^TUS_PluginInfo; - TUS_PluginInfo = record - cbSize: integer; //Size of this record (usefull if record will be extended in the future) - - Name: array [0..31] of char; //Name of the Plugin - Version: dword; //Version of the Plugin - Description: array [0..127] of char; //Description, what does this Plugin do - Author: array [0..31] of char; //Author of this Plugin - AuthorEmail: array [0..63] of char; //Authors Email - Homepage: array [0..63] of char; //Homepage of Plugin/Author - end; - AUS_PluginInfo = array of TUS_PluginInfo; - PAUS_PluginInfo = ^AUS_PluginInfo; - - //---------------- - // TUS_Hook - Structure of the Hook function - // Return 0 if the Hook should be continue, - // or a non zero Value, if the Hook should be Interuped - // In this Case the Caller of the Notifier gets the Return Value - // Return Value Should not be -1 - //---------------- - TUS_Hook = function (wParam: TwParam; lParam: TlParam): integer; stdcall; - TUS_Hook_of_Object = function (wParam: TwParam; lParam: TlParam): integer of Object; - - //---------------- - // TUS_Service - Structure of the Service function - // This function is called if the Registered Service is Called - // Return Value Should not be SERVICE_NOT_FOUND - //---------------- - TUS_Service = function (wParam: TwParam; lParam: TlParam): integer; stdcall; - TUS_Service_of_Object = function (wParam: TwParam; lParam: TlParam): integer of Object; - - //---------------- - // TUS_PluginInterface - Structure that Includes all Methods callable - // from the Plugins - //---------------- - PUS_PluginInterface = ^TUS_PluginInterface; - TUS_PluginInterface = record - {******** Hook specific Methods ********} - {Function Creates a new Hookable Event and Returns the Handle - or 0 on Failure. (Name already exists)} - CreateHookableEvent: function (EventName: PChar): THandle; stdcall; - - {Function Destroys an Event and Unhooks all Hooks to this Event. - 0 on success, not 0 on Failure} - DestroyHookableEvent: function (hEvent: THandle): integer; stdcall; - - {Function start calling the Hook Chain - 0 if Chain is called until the End, -1 if Event Handle is not valid - otherwise Return Value of the Hook that breaks the Chain} - NotivyEventHooks: function (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall; - - {Function Hooks an Event by Name. - Returns Hook Handle on Success, otherwise 0} - HookEvent: function (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall; - - {Function Removes the Hook from the Chain - Returns 0 on Success} - UnHookEvent: function (hHook: THandle): integer; stdcall; - - {Function Returns Non Zero if a Event with the given Name Exists, - otherwise 0} - EventExists: function (EventName: PChar): integer; stdcall; - - {******** Service specific Methods ********} - {Function Creates a new Service and Returns the Services Handle - or 0 on Failure. (Name already exists)} - CreateService: function (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall; - - {Function Destroys a Service. - 0 on success, not 0 on Failure} - DestroyService: function (hService: THandle): integer; stdcall; - - {Function Calls a Services Proc - Returns Services Return Value or SERVICE_NOT_FOUND on Failure} - CallService: function (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall; - - {Function Returns Non Zero if a Service with the given Name Exists, - otherwise 0} - ServiceExists: function (ServiceName: PChar): integer; stdcall; - end; - - //---------------- - //TModuleInfo: Info about Modules. Result of Core/GetModuleInfo - //---------------- - PModuleInfo = ^TModuleInfo; - TModuleInfo = record - Name: string; - Version: LongWord; - Description: string; - end; - AModuleInfo = array of TModuleInfo; - - //---------------- - // Procs that should be exported by Plugin Dlls - //---------------- - //Procedure is called to check if this is USDx Plugin - //Info is Pointer to this Plugins Info. Size is already set. Don't write over this limit - Proc_PluginInfo = procedure (Info: PUS_PluginInfo); stdcall; - - //Called on Plugins Load. If Non Zero is Returned => abort Loading - //PInterface is Pointer to PluginInterface - Func_Load = function (const PInterface: PUS_PluginInterface): integer; stdcall; - - //Called on Plugins Init. If Non Zero is Returned => abort Loading - //PInterface is Pointer to PluginInterface - Func_Init = function (const PInterface: PUS_PluginInterface): integer; stdcall; - - //Called on Plugins Deinit. - //PInterface is Pointer to PluginInterface - Proc_DeInit = procedure (const PInterface: PUS_PluginInterface); stdcall; - -//---------------- -// Some Default Constants -//---------------- -const - {Returned if Service is not found from CallService} - SERVICE_NOT_FOUND = LongInt($80000000); - - //for use in Service 'Core/ShowMessage' lParam(Symbol) - CORE_SM_NOSYMBOL= 0; - CORE_SM_ERROR = 1; - CORE_SM_WARNING = 2; - CORE_SM_INFO = 3; - -//---------------- -// Some functions to Handle Version dwords -//---------------- -function MakeVersion(const HeadRevision, SubVersion, SubVersion2: byte; Letter: char): dword; -function VersionToString(const Version: dword): string; - -implementation - -//-------------- -// MakeVersion - converts 4 values to a valid version dword -//-------------- -function MakeVersion(const HeadRevision, SubVersion, SubVersion2: byte; Letter: char): dword; -begin - if(letter < 'a') or (Letter > 'z') then - letter := chr(0); - - Result := (HeadRevision shl 24) or (SubVersion shl 16) or (SubVersion2 shl 8) or Ord(Letter); -end; - -//-------------- -// VersiontoString - Returns some beauty '1.0.2a' like string -//-------------- -function VersionToString(const Version: dword): string; -begin // to-do : Write VersiontoString without SysUtils dependence - //Result := InttoStr((ver and $FF000000) shr 24); - Result := '1.0.1' -end; - -end. diff --git a/unicode/plugins/Team_Duell/TeamDuell.dpr b/unicode/plugins/Team_Duell/TeamDuell.dpr index cb0e6349..1371c95d 100644 --- a/unicode/plugins/Team_Duell/TeamDuell.dpr +++ b/unicode/plugins/Team_Duell/TeamDuell.dpr @@ -5,206 +5,236 @@ library TeamDuell ; {$ENDIF} uses - 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; + SysUtils, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; 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; - TtoNextChange, starttick, endtick, ChangeOnSentence : Cardinal; - bps, RTtoNextChange: Double; - firsttime, secondtime: boolean; - - -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; + 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} 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 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 + // 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 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; stdcall; +// 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} var -I,J: Integer; + Index, J: integer; begin - // Get beginning of sentences - for I := 0 to Sentences.High do begin - SetLength(Startpoints, I+1); - Startpoints[I]:=Sentences.Sentence[I].Start; +// 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 - for I := 0 to TeamInfo.NumTeams-1 do + // 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 begin - 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) ; + 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; 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 := SDL_GetTicks(); + starttick := GetTicks; firsttime := true; secondtime := true; bps := 1; MethodRec := Methods; - Result := True; + Result := true; end; -//Executed everytime the Screen is Drawed //If False The Game finishes -function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; +// 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} var - I,timeline,x,y: Integer; - display: PChar; - start: boolean; + Index, timeline, x, y: integer; + display: PChar; + TimeString: 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 := SDL_GetTicks(); + starttick := GetTicks; end; start := false; - // show first singers for 5sec - if (CurSentence < 1) AND ((starttick + 5000) > SDL_GetTicks()) then begin start := true; end; + // show first singer for 5 sec + if (CurSentence < 1) and ((starttick + 5000) > GetTicks) then + start := true; // TickCount(thirdSentence) - If (CurSentence = 3) AND (secondtime) then + if (CurSentence = 3) and (secondtime) then begin secondtime := false; firsttime := true; - endtick := SDL_GetTicks(); + endtick := GetTicks; bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond end; - // Time to next Change - RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); - TtoNextChange := Trunc(RTtoNextChange) +1; + // Time to next change + RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTicks - starttick) / 1000); + TimeToNextChange := Trunc(RTimeToNextChange) + 1; - // 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]; + // 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]; repeat - NextSinger[I] := random(SPT[I]); - until NOT(NextSinger[I] = CurSinger[I]) OR (SPT[I] = 1) ; + NextSinger[Index] := random(SPT[Index]); + 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[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'; + 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'; // timeline - 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); + 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); end; // Names, Timer - 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))))); + 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[I,CurSinger[I]]); - if (TtoNextChange <= 11) OR (start) Then MethodRec.Print (1, 18, PlayerInfo.Playerinfo[I].PosX+5, PlayerInfo.Playerinfo[I].PosY+10, display); + 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); + end; + if (CurSentence = ChangeOnSentence) then + begin + ChangeOnSentence := CurSentence + 7; + firsttime := true; end; - if (CurSentence = ChangeOnSentence) then begin ChangeOnSentence := CurSentence + 7; firsttime := true; end; -Result := True; + Result := true; end; -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +// is executed on finish, returns the player number of the winner +function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - I:Integer; - MaxScore: Word; + Index: integer; + MaxScore: word; begin Result := 0; MaxScore := 0; - for I := 0 to PlayerInfo.NumPlayers-1 do + for Index := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (PlayerInfo.Playerinfo[I].Score > MaxScore) then + PlayerInfo.Playerinfo[Index].Percentage := PlayerInfo.Playerinfo[Index].Score div 9999; + if (PlayerInfo.Playerinfo[Index].Score > MaxScore) then begin - MaxScore := PlayerInfo.Playerinfo[I].Score; - Case I of + MaxScore := PlayerInfo.Playerinfo[Index].Score; + case Index of 0: Result := 1; 1: Result := 2; 2: Result := 4; @@ -213,26 +243,29 @@ begin 5: Result := 32; end; end - else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].Score <> 0) then + else if (PlayerInfo.Playerinfo[Index].Score = MaxScore) and (PlayerInfo.Playerinfo[Index].Score <> 0) then begin - 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; + 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; end; end; end; - //When nobody has Points -> Everybody loose + // When nobody has points -> everybody looses if (MaxScore = 0) then Result := 0; end; exports -PluginInfo, Init, Draw, Finish; + PluginInfo, + Init, + Draw, + Finish; begin |