From 2c87ea1040f8fc02fcadbf920d02685198a0c216 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 27 Aug 2008 15:26:05 +0000 Subject: Artwork/Game/Modis/Tools changed to lower case git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1314 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Artwork/usdx_icon.svg | 4001 ------------------------- Modis/5000Points/Until5000.dpr | 97 - Modis/Blind/Blind.dpr | 102 - Modis/Don't_Get_Worse/Hold_The_Line.dpr | 212 -- Modis/Duell/Duell.dpr | 99 - Modis/SDK/Hooks.txt | 20 - Modis/SDK/ModiSDK.pas | 156 - Modis/SDK/Plugin DLL Exports.txt | 11 - Modis/SDK/Services.txt | 22 - Modis/SDK/StrUtils.pas | 73 - Modis/SDK/UPartyDefs.pas | 189 -- Modis/SDK/UPluginDefs.pas | 195 -- Modis/Team_Duell/TeamDuell.dpr | 237 -- Tools/ResourceExtractor/Makefile.in | 19 - Tools/ResourceExtractor/ResourceExtractor.lpi | 106 - Tools/ResourceExtractor/ResourceExtractor.pas | 152 - Tools/ScoreConverter/ScoreConverter.dpr | 17 - Tools/ScoreConverter/ScoreConverter.ico | Bin 766 -> 0 bytes Tools/ScoreConverter/ScoreConverter.res | Bin 876 -> 0 bytes Tools/ScoreConverter/UScores.pas | 102 - Tools/ScoreConverter/USongs.pas | 160 - Tools/ScoreConverter/Umainform.dfm | 123 - Tools/ScoreConverter/Umainform.pas | 230 -- artwork/usdx_icon.svg | 4001 +++++++++++++++++++++++++ plugins/5000Points/Until5000.dpr | 97 + plugins/Blind/Blind.dpr | 102 + plugins/Don't_Get_Worse/Hold_The_Line.dpr | 212 ++ plugins/Duell/Duell.dpr | 99 + plugins/SDK/Hooks.txt | 20 + plugins/SDK/ModiSDK.pas | 156 + plugins/SDK/Plugin DLL Exports.txt | 11 + plugins/SDK/Services.txt | 22 + plugins/SDK/StrUtils.pas | 73 + plugins/SDK/UPartyDefs.pas | 189 ++ plugins/SDK/UPluginDefs.pas | 195 ++ plugins/Team_Duell/TeamDuell.dpr | 237 ++ tools/ResourceExtractor/Makefile.in | 19 + tools/ResourceExtractor/ResourceExtractor.lpi | 106 + tools/ResourceExtractor/ResourceExtractor.pas | 152 + tools/ScoreConverter/ScoreConverter.dpr | 17 + tools/ScoreConverter/ScoreConverter.ico | Bin 0 -> 766 bytes tools/ScoreConverter/ScoreConverter.res | Bin 0 -> 876 bytes tools/ScoreConverter/UScores.pas | 102 + tools/ScoreConverter/USongs.pas | 160 + tools/ScoreConverter/Umainform.dfm | 123 + tools/ScoreConverter/Umainform.pas | 230 ++ 46 files changed, 6323 insertions(+), 6323 deletions(-) delete mode 100644 Artwork/usdx_icon.svg delete mode 100644 Modis/5000Points/Until5000.dpr delete mode 100644 Modis/Blind/Blind.dpr delete mode 100644 Modis/Don't_Get_Worse/Hold_The_Line.dpr delete mode 100644 Modis/Duell/Duell.dpr delete mode 100644 Modis/SDK/Hooks.txt delete mode 100644 Modis/SDK/ModiSDK.pas delete mode 100644 Modis/SDK/Plugin DLL Exports.txt delete mode 100644 Modis/SDK/Services.txt delete mode 100644 Modis/SDK/StrUtils.pas delete mode 100644 Modis/SDK/UPartyDefs.pas delete mode 100644 Modis/SDK/UPluginDefs.pas delete mode 100644 Modis/Team_Duell/TeamDuell.dpr delete mode 100644 Tools/ResourceExtractor/Makefile.in delete mode 100644 Tools/ResourceExtractor/ResourceExtractor.lpi delete mode 100644 Tools/ResourceExtractor/ResourceExtractor.pas delete mode 100644 Tools/ScoreConverter/ScoreConverter.dpr delete mode 100644 Tools/ScoreConverter/ScoreConverter.ico delete mode 100644 Tools/ScoreConverter/ScoreConverter.res delete mode 100644 Tools/ScoreConverter/UScores.pas delete mode 100644 Tools/ScoreConverter/USongs.pas delete mode 100644 Tools/ScoreConverter/Umainform.dfm delete mode 100644 Tools/ScoreConverter/Umainform.pas create mode 100644 artwork/usdx_icon.svg create mode 100644 plugins/5000Points/Until5000.dpr create mode 100644 plugins/Blind/Blind.dpr create mode 100644 plugins/Don't_Get_Worse/Hold_The_Line.dpr create mode 100644 plugins/Duell/Duell.dpr create mode 100644 plugins/SDK/Hooks.txt create mode 100644 plugins/SDK/ModiSDK.pas create mode 100644 plugins/SDK/Plugin DLL Exports.txt create mode 100644 plugins/SDK/Services.txt create mode 100644 plugins/SDK/StrUtils.pas create mode 100644 plugins/SDK/UPartyDefs.pas create mode 100644 plugins/SDK/UPluginDefs.pas create mode 100644 plugins/Team_Duell/TeamDuell.dpr create mode 100644 tools/ResourceExtractor/Makefile.in create mode 100644 tools/ResourceExtractor/ResourceExtractor.lpi create mode 100644 tools/ResourceExtractor/ResourceExtractor.pas create mode 100644 tools/ScoreConverter/ScoreConverter.dpr create mode 100644 tools/ScoreConverter/ScoreConverter.ico create mode 100644 tools/ScoreConverter/ScoreConverter.res create mode 100644 tools/ScoreConverter/UScores.pas create mode 100644 tools/ScoreConverter/USongs.pas create mode 100644 tools/ScoreConverter/Umainform.dfm create mode 100644 tools/ScoreConverter/Umainform.pas diff --git a/Artwork/usdx_icon.svg b/Artwork/usdx_icon.svg deleted file mode 100644 index 49719bba..00000000 --- a/Artwork/usdx_icon.svg +++ /dev/null @@ -1,4001 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - File Manager - - - Jakub Steiner - - - http://jimmac.musichall.cz - - - file - manager - copy - move - filesystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Modis/5000Points/Until5000.dpr b/Modis/5000Points/Until5000.dpr deleted file mode 100644 index 507159ff..00000000 --- a/Modis/5000Points/Until5000.dpr +++ /dev/null @@ -1,97 +0,0 @@ -library Until5000; - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I ../../Game/Code/switches.inc} - -uses - ModiSDK in '..\SDK\ModiSDK.pas'; - -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -begin - Info.Name := 'PLUGIN_UNTIL5000_NAME'; - - Info.Creator := 'Whiteshark'; - Info.PluginDesc := 'PLUGIN_UNTIL5000_DESC'; - - //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 := 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 -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} -begin -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} -var -I: Integer; -begin -Result := False; - for I := 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 - Exit; - end; -Result := True; -end; - -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -var - I:Integer; -begin -Result := 0; -for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if (PlayerInfo.Playerinfo[I].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; - end; - end; - end; -end; - -exports -PluginInfo, Init, Draw, Finish; - -begin - -end. \ No newline at end of file diff --git a/Modis/Blind/Blind.dpr b/Modis/Blind/Blind.dpr deleted file mode 100644 index 2f94229c..00000000 --- a/Modis/Blind/Blind.dpr +++ /dev/null @@ -1,102 +0,0 @@ -library Blind; - -uses - ModiSDK in '..\SDK\ModiSDK.pas'; - -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; -begin - Info.Name := 'PLUGIN_BLIND_NAME'; - - Info.Creator := 'Whiteshark'; - Info.PluginDesc := 'PLUGIN_BLIND_DESC'; - - //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 := 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.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_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 -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; -begin -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; -begin -Result := True; -end; - -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; -var - I:Integer; - MaxScore: Word; -begin - Result := 0; - MaxScore := 0; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (PlayerInfo.Playerinfo[I].Score > MaxScore) then - begin - MaxScore := PlayerInfo.Playerinfo[I].Score; - Case I of - 0: Result := 1; - 1: Result := 2; - 2: Result := 4; - 3: Result := 8; - 4: Result := 16; - 5: Result := 32; - end; - end - else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; - end; - end; - end; - //If everybody has 0 Points nobody Wins - If (MaxScore = 0) then - Result := 0; -end; - -exports -PluginInfo, Init, Draw, Finish; - -begin - -end. \ No newline at end of file diff --git a/Modis/Don't_Get_Worse/Hold_The_Line.dpr b/Modis/Don't_Get_Worse/Hold_The_Line.dpr deleted file mode 100644 index a197d51b..00000000 --- a/Modis/Don't_Get_Worse/Hold_The_Line.dpr +++ /dev/null @@ -1,212 +0,0 @@ -library Hold_The_Line; - -uses - ModiSDK in '..\SDK\ModiSDK.pas', - StrUtils in '..\SDK\StrUtils.pas', - OpenGL12, - Windows; - -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; -begin - Info.Name := 'PLUGIN_HDL_NAME'; - - Info.Creator := 'Whiteshark'; - Info.PluginDesc := 'PLUGIN_HDL_DESC'; - - //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 -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; -var - I: Integer; - Texname: PChar; - TexType: TTextureType; -begin - TexName := CreateStr(PChar('HDL_Pointer')); - TexType := TEXTURE_TYPE_TRANSPARENT; - PointerTex := Methods.LoadTex(TexName, TexType); - - FreeStr(TexName); - - TexName := CreateStr(PChar('dismissed.mp3')); - DismissedSound := Methods.LoadSound (TexName); - FreeStr(TexName); - - CountSentences := Sentences.High; - Limit := 0; - Frame := 0; - - MethodRec := Methods; - - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Enabled := True; - PlayerInfo.Playerinfo[I].Percentage := 100; - PlayerTimes[I] := 0; - end; - - LoadOpenGL; - - 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; - L: Byte; - C: Byte; - Text: PChar; - Blink: Boolean; - tick: Cardinal; -begin - //Aktivate Blink - If (CurSentence = CountSentences div 5 * 2 - 1) OR (CurSentence = CountSentences div 3 * 2 - 1) then - begin - Tick := Gettickcount div 400; - If (Tick <> LastTick) then - begin - LastTick := Tick; - PointerVisible := Not PointerVisible; - end; - end - else - PointerVisible := True; - - //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 - Inc(Limit); - - case Limit of - 0: L := 20; - 1: L := 50; - 2: L := 75; - end; - - C:= 0; - - Result := True; - - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - if PlayerInfo.Playerinfo[I].Bar < L then - begin - PlayerInfo.Playerinfo[I].Enabled := False; - Inc(C); - PlayerTimes[I] := CurSentence; //Save Time of Dismission - //PlaySound - MethodRec.PlaySound (DismissedSound); - end; - - //Draw Pointer - if (PointerVisible) then - begin - glColor4f (0.2, 0.8, 0.1, 1); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - 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); - glEnd; - - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - end; - - end - else - begin - Inc(C); - //Draw Dismissed - Text := CreateStr(PChar('PARTY_DISMISSED')); - - glColor4f (0.8, 0.8, 0.8, 1); - - MethodRec.Print (1, 6, PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY-8, Text); - FreeStr(Text); - end; - end; - if (C >= PlayerInfo.NumPlayers-1) then - Result := False; -end; - -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; -var - I:Integer; -begin -Result := 0; -for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Percentage := (PlayerTimes[I] * 100) div CountSentences; - if (PlayerInfo.Playerinfo[I].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; - end; - end; - end; -end; - -exports -PluginInfo, Init, Draw, Finish; - -begin - -end. diff --git a/Modis/Duell/Duell.dpr b/Modis/Duell/Duell.dpr deleted file mode 100644 index 3aff4d3e..00000000 --- a/Modis/Duell/Duell.dpr +++ /dev/null @@ -1,99 +0,0 @@ -library Duell; - -uses - ModiSDK in '..\SDK\ModiSDK.pas'; - -//Gave the Plugins Info -procedure PluginInfo (var Info: TPluginInfo); stdcall; -begin - Info.Name := 'PLUGIN_DUELL_NAME'; - - Info.Creator := 'Whiteshark'; - Info.PluginDesc := 'PLUGIN_DUELL_DESC'; - - 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:= 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_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 -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; -begin -Result := True; -end; - -//Executed everytime the Screen is Drawed //If False The Game finishes -function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; -begin -Result := True; -end; - -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; -var - I:Integer; - MaxScore: Word; -begin - Result := 0; - MaxScore := 0; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (PlayerInfo.Playerinfo[I].Score > MaxScore) then - begin - MaxScore := PlayerInfo.Playerinfo[I].Score; - Case I of - 0: Result := 1; - 1: Result := 2; - 2: Result := 4; - 3: Result := 8; - 4: Result := 16; - 5: Result := 32; - end; - end - else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; - end; - end; - end; - - //When nobody has Points -> Everybody loose - if (MaxScore = 0) then - Result := 0; -end; - -exports -PluginInfo, Init, Draw, Finish; - -begin - -end. \ No newline at end of file diff --git a/Modis/SDK/Hooks.txt b/Modis/SDK/Hooks.txt deleted file mode 100644 index 999f552f..00000000 --- a/Modis/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/Modis/SDK/ModiSDK.pas b/Modis/SDK/ModiSDK.pas deleted file mode 100644 index 76dcf8ea..00000000 --- a/Modis/SDK/ModiSDK.pas +++ /dev/null @@ -1,156 +0,0 @@ -unit ModiSDK; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -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 - - //Plugin Typ, atm: 8 only for PartyMode Modi - 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 - ); - - end; - - TPlayerInfo = record - 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 - end; - end; - - TTeamInfo = record - NumTeams: Byte; - Teaminfo: array[0..5] of record - Name: PChar; - Score: Word; - Joker: Byte; - CurPlayer: Byte; - NumPlayers: Byte; - Playerinfo: array[0..3] of record - Name: PChar; - TimesPlayed: Byte; - - end; - end; - end; - - TsmallTexture = record - 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 - Start: integer; - StartNote: integer; - Lyric: string; - LyricWidth: real; - End_: integer; - BaseNote: integer; - HighNote: integer; - IlNut: integer; - TotalNotes: integer; - Note: array of record - Color: integer; - Start: integer; - Length: integer; - Tone: integer; - //Text: string; - FreeStyle: boolean; - Typ: integer; // zwykla nuta x1, zlota nuta x2 - end; - end; - end; - - DWORD = Longword; - HSTREAM = DWORD; - - TTextureType = ( - TEXTURE_TYPE_PLAIN, // Plain (alpha = 1) - TEXTURE_TYPE_TRANSPARENT, // Alpha is used - 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 - - TMethodRec = record - LoadTex: fModi_LoadTex; - Print: fModi_Print; - 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; - -implementation - -end. diff --git a/Modis/SDK/Plugin DLL Exports.txt b/Modis/SDK/Plugin DLL Exports.txt deleted file mode 100644 index 930e18ac..00000000 --- a/Modis/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/Modis/SDK/Services.txt b/Modis/SDK/Services.txt deleted file mode 100644 index 8db031d8..00000000 --- a/Modis/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/Modis/SDK/StrUtils.pas b/Modis/SDK/StrUtils.pas deleted file mode 100644 index a5735b8f..00000000 --- a/Modis/SDK/StrUtils.pas +++ /dev/null @@ -1,73 +0,0 @@ -unit StrUtils; - -interface - -{$I switches.inc} - -uses ModiSDK; - -//function StrToAChar(Str: String): AChar; -function CreateStr(Str: PChar): PChar; -procedure FreeStr(Str: PChar); - -implementation - -{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. \ No newline at end of file diff --git a/Modis/SDK/UPartyDefs.pas b/Modis/SDK/UPartyDefs.pas deleted file mode 100644 index 09f97812..00000000 --- a/Modis/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/Modis/SDK/UPluginDefs.pas b/Modis/SDK/UPluginDefs.pas deleted file mode 100644 index 4cd094f7..00000000 --- a/Modis/SDK/UPluginDefs.pas +++ /dev/null @@ -1,195 +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 64Bit addresses in 64 Bit Systems(FreePascal) - {$ENDIF} - //wParam is mainly used for Ordninals - //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 VersiontoSting(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 VersiontoSting(const Version: DWord): String; -begin // to-do : Write VersiontoString without SysUtils depencies - //Result := InttoStr((ver and $FF000000) shr 24); - Result := '1.0.1' -end; - -end. diff --git a/Modis/Team_Duell/TeamDuell.dpr b/Modis/Team_Duell/TeamDuell.dpr deleted file mode 100644 index 20db2b2e..00000000 --- a/Modis/Team_Duell/TeamDuell.dpr +++ /dev/null @@ -1,237 +0,0 @@ -library TeamDuell ; - -uses - ModiSDK in '..\SDK\ModiSDK.pas', - StrUtils in '..\SDK\StrUtils.pas', - sysutils, - OpenGL12, - Windows; - -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; -begin - Info.Name := 'PLUGIN_TEAMDUELL_NAME'; - - Info.Creator := 'jekatt'; - Info.PluginDesc := 'PLUGIN_TEAMDUELL_DESC'; - - 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 -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; -var -I,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; - end; - // Get Teams and Players - for I := 0 to TeamInfo.NumTeams-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) ; - end; - ChangeOnSentence := 8; - starttick := GetTickCount; - firsttime := true; - secondtime := true; - bps := 1; - MethodRec := Methods; - LoadOpenGL; - 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,timeline,x,y: Integer; - display: PChar; - start: boolean; -begin - // TickCount(firstSentence) (not zero!) - If (CurSentence = ChangeOnSentence - 7) AND (firsttime) then - begin - firsttime := false; - starttick := GetTickCount; - end; - start := false; - // show first singers for 5sec - if (CurSentence < 1) AND ((starttick + 5000) > GetTickCount) then begin start := true; end; - - // TickCount(thirdSentence) - If (CurSentence = 3) AND (secondtime) then - begin - secondtime := false; - firsttime := true; - endtick := GetTickCount; - bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond - end; - - // Time to next Change - RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTickCount - starttick) / 1000); - TtoNextChange := Trunc(RTtoNextChange) +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]; - repeat - NextSinger[I] := random(SPT[I]); - until NOT(NextSinger[I] = CurSinger[I]) OR (SPT[I] = 1) ; - end; - - // display bg - 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'; - - // 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); - 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, 6, PlayerInfo.Playerinfo[I].PosX+85, PlayerInfo.Playerinfo[I].PosY+10, CreateStr(PChar(IntToStr(Trunc(TtoNextChange))))); - 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, 6, PlayerInfo.Playerinfo[I].PosX+5, PlayerInfo.Playerinfo[I].PosY+10, display); - end; - if (CurSentence = ChangeOnSentence) then begin ChangeOnSentence := CurSentence + 7; firsttime := true; end; -Result := True; -end; - -//Is Executed on Finish, Returns the Playernum of the Winner -function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; -var - I:Integer; - MaxScore: Word; -begin - Result := 0; - MaxScore := 0; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; - if (PlayerInfo.Playerinfo[I].Score > MaxScore) then - begin - MaxScore := PlayerInfo.Playerinfo[I].Score; - Case I of - 0: Result := 1; - 1: Result := 2; - 2: Result := 4; - 3: Result := 8; - 4: Result := 16; - 5: Result := 32; - end; - end - else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; - end; - end; - end; - - //When nobody has Points -> Everybody loose - if (MaxScore = 0) then - Result := 0; -end; - -exports -PluginInfo, Init, Draw, Finish; - -begin - -end. - - diff --git a/Tools/ResourceExtractor/Makefile.in b/Tools/ResourceExtractor/Makefile.in deleted file mode 100644 index 709365d7..00000000 --- a/Tools/ResourceExtractor/Makefile.in +++ /dev/null @@ -1,19 +0,0 @@ -PPC = @PPC@ -PFLAGS = -dRELEASE - -NAME = ResourceExtractor -SRC = $(NAME).pas -BIN = $(NAME)@EXEEXT@ - -.PHONY: all clean distclean - -all: $(BIN) - -clean: - rm -f $(BIN) *.o *.ppu *.rst *.compiled - -distclean: clean - rm -rf Makefile *~ *.bak __history - -$(BIN): $(SRC) - $(PPC) $(PFLAGS) -o$@ $(SRC) diff --git a/Tools/ResourceExtractor/ResourceExtractor.lpi b/Tools/ResourceExtractor/ResourceExtractor.lpi deleted file mode 100644 index 82ecf87e..00000000 --- a/Tools/ResourceExtractor/ResourceExtractor.lpi +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tools/ResourceExtractor/ResourceExtractor.pas b/Tools/ResourceExtractor/ResourceExtractor.pas deleted file mode 100644 index aa9cc3bc..00000000 --- a/Tools/ResourceExtractor/ResourceExtractor.pas +++ /dev/null @@ -1,152 +0,0 @@ -program ResourceExtractor; - -{$ifdef FPC} - {$mode delphi}{$H+} -{$endif} - -uses - Classes, - SysUtils, - StrUtils; - - -var - ResCount: integer; - OutStream: TStringList; - - -procedure Init(); -begin - OutStream := TStringList.Create(); - - OutStream.Add('const'); - // placeholder for array-header (will be filled on file-saving) - OutStream.Add(''); -end; - -procedure SaveToFile(const OutFileName: string); -begin - // add array-header - OutStream[1] := ' resources: array[0..'+IntToStr(ResCount-1)+', 0..2] of string = ('; - // add trailer - OutStream.Add(' );'); - - // save file - try - OutStream.SaveToFile(OutFileName); - except - OutStream.Free(); - raise Exception.Create('Could not save to file: "' + OutFileName + '"'); - end; - - OutStream.Free(); -end; - -function AddResource(Fields: TStringList; const RCFileDir, ResDir: string): boolean; -var - ResName, ResType, ResFile: string; -begin - if (Fields.Count < 3) or - (AnsiStartsStr('//', Fields[0])) or - (Length(Fields[2]) < 3) then - begin - Result := false; - Exit; - end; - - // add a trailing comma to the last line - if (ResCount > 0) then - OutStream[OutStream.Count-1] := OutStream[OutStream.Count-1] + ','; - - ResName := Fields[0]; - ResType := Fields[1]; - ResFile := Fields[2]; - - Writeln('ADD: [' + ResType + ':' + ResName + ' = ' +ResFile + ']'); - - // quote fields - ResName := AnsiQuotedStr(ResName, '''')+','; - ResType := AnsiQuotedStr(ResType, '''')+','; - // strip surrounding quotes of filename - ResFile := AnsiMidStr(ResFile, 2, Length(Fields[2])-2); - // now translate the resource filename (relative to the RC-file) to be relative to the resource-dir - // 1st step: get absolute path of the resource - ResFile := ExpandFileName(RCFileDir + ResFile); - // 2nd step: get path of the resource relative to the resource-dir - // Note: both paths must be absolute and the base-path must have a trailing '/' or '\' - ResFile := ExtractRelativepath(ResDir, ResFile); - // 3rd step: ... and quote - ResFile := AnsiQuotedStr(ResFile, ''''); - - // compose line - OutStream.Add(Format(' (%-20S%-8S%S)', [ResName, ResType, ResFile])); - - Inc(ResCount); - - Result := true; -end; - -procedure ExtractResources(const InFileName, ResDir: string); -var - Fields: TStringList; - LineIndex: integer; - Lines: TStringList; - RCFileDirAbs, ResDirAbs: string; -begin - // get absolute paths - RCFileDirAbs := ExtractFilePath(ExpandFileName(InFileName)); - ResDirAbs := ExpandFileName(ResDir) + '/'; - - Lines := TStringList.Create(); - try - Lines.LoadFromFile(InFileName); - except - raise Exception.Create('Failed to open file: "' + InFileName + '"'); - end; - - Fields := TStringList.Create(); - for LineIndex := 0 to Lines.Count-1 do - begin - Fields.Clear(); - // split line into [Name, Type, File] - ExtractStrings([' ', #9], [], PChar(Lines[LineIndex]), Fields); - if (not AddResource(Fields, RCFileDirAbs, ResDirAbs)) then - Writeln( 'SKIP: "'+Lines[LineIndex]+'"'); - end; - - Lines.Free(); - Fields.Free(); -end; - -var - ProgName: string; -begin - if (ParamCount <> 3) then - begin - ProgName := ExtractFileName(ParamStr(0)); - WriteLn('Usage: ' + ProgName + ' RC-File Resource-Dir Output-File'); - Exit; - end; - - WriteLn('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); - WriteLn('Converting "' + ParamStr(1) + '" to "' + ParamStr(3) + '"'); - WriteLn('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); - - try - Init(); - ExtractResources(ParamStr(1), ParamStr(2)); - SaveToFile(ParamStr(3)); - except on E:Exception do - begin - WriteLn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); - WriteLn('Conversion failed: ' + E.Message + '!'); - WriteLn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); - Exit; - end; - end; - - WriteLn('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'); - WriteLn('Conversion finished!'); - WriteLn('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'); -end. - diff --git a/Tools/ScoreConverter/ScoreConverter.dpr b/Tools/ScoreConverter/ScoreConverter.dpr deleted file mode 100644 index 2774cde4..00000000 --- a/Tools/ScoreConverter/ScoreConverter.dpr +++ /dev/null @@ -1,17 +0,0 @@ -program ScoreConverter; - -uses - Forms, - Umainform in 'Umainform.pas' {mainform}, - UScores in 'UScores.pas', - UDataBase in '..\Game\Code\Classes\UDataBase.pas', - USongs in 'USongs.pas'; - -{$R *.res} - -begin - Application.Initialize; - Application.Title := 'Score Converter'; - Application.CreateForm(Tmainform, mainform); - Application.Run; -end. diff --git a/Tools/ScoreConverter/ScoreConverter.ico b/Tools/ScoreConverter/ScoreConverter.ico deleted file mode 100644 index 80319014..00000000 Binary files a/Tools/ScoreConverter/ScoreConverter.ico and /dev/null differ diff --git a/Tools/ScoreConverter/ScoreConverter.res b/Tools/ScoreConverter/ScoreConverter.res deleted file mode 100644 index 2d3bea87..00000000 Binary files a/Tools/ScoreConverter/ScoreConverter.res and /dev/null differ diff --git a/Tools/ScoreConverter/UScores.pas b/Tools/ScoreConverter/UScores.pas deleted file mode 100644 index 801d796e..00000000 --- a/Tools/ScoreConverter/UScores.pas +++ /dev/null @@ -1,102 +0,0 @@ -unit UScores; - -interface - -uses USongs; - -procedure ReadScore(var Song: TSong); -procedure WriteScore(var Song: TSong); -procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); - -implementation - -uses IniFiles, SysUtils; - -procedure ReadScore(var Song: TSong); -var - F: TIniFile; - S: string; - P: integer; - Lev: integer; - LevS: string; -begin - F := TIniFile.Create(Song.Path + ChangeFileExt(Song.FileName, '.sco')); - - for Lev := 0 to 2 do begin - case Lev of - 0: LevS := 'Easy'; - 1: LevS := 'Normal'; - 2: LevS := 'Hard'; - end; - - P := 1; - S := F.ReadString(LevS + IntToStr(P), 'Name', ''); - while (S <> '') and (P<=5) do begin - SetLength(Song.Score[Lev], P); - Song.Score[Lev, P-1].Name := S; - Song.Score[Lev, P-1].Score := F.ReadInteger(LevS + IntToStr(P), 'Score', 0); - - Inc(P); - S := F.ReadString(LevS + IntToStr(P), 'Name', ''); - end; - end; -end; - -procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); -var - S: integer; - S2: integer; -begin - S := 0; - while (S <= High(Song.Score[Level])) and (Score <= Song.Score[Level, S].Score) do - Inc(S); - // S has the number for new score - - - // we create new score - SetLength(Song.Score[Level], Length(Song.Score[Level]) + 1); - - // we move down old scores - for S2 := High(Song.Score[Level])-1 downto S do - Song.Score[Level, S2+1] := Song.Score[Level, S2]; - - // we fill new score - Song.Score[Level, S].Name := Name; - Song.Score[Level, S].Score := Score; - - if Length(Song.Score[Level]) > 5 then begin - SetLength(Song.Score[Level], 5); - end; -end; - -procedure WriteScore(var Song: TSong); -var - F: TIniFile; - S: integer; - Lev: integer; - LevS: string; - FileName: string; -begin - FileName := Song.Path + ChangeFileExt(Song.FileName, '.sco'); - if (not FileExists(FileName)) or (FileExists(FileName) and DeleteFile(FileName)) then begin - // file has been deleted -> creating new file - F := TIniFile.Create(FileName); - - for Lev := 0 to 2 do begin - case Lev of - 0: LevS := 'Easy'; - 1: LevS := 'Normal'; - 2: LevS := 'Hard'; - end; - - for S := 0 to high(Song.Score[Lev]) do begin - F.WriteString(LevS + IntToStr(S+1), 'Name', Song.Score[Lev, S].Name); - F.WriteInteger(LevS + IntToStr(S+1), 'Score', Song.Score[Lev, S].Score); - - end; // for S - end; // for Lev - F.Free; - end; // if -end; - -end. diff --git a/Tools/ScoreConverter/USongs.pas b/Tools/ScoreConverter/USongs.pas deleted file mode 100644 index 8f20f44f..00000000 --- a/Tools/ScoreConverter/USongs.pas +++ /dev/null @@ -1,160 +0,0 @@ -unit USongs; - -interface - -type - TScore = record - Name: string; - Score: integer; - Length: string; - end; - - TSong = record - Path: string; - FileName: string; - - Title: string; - Artist: string; - - Score: array[0..2] of array of TScore; - end; - - TSongs = class - LastCount: Integer; - Song: array of TSong; // array of songs - - function ReadHeader(var rSong: TSong): boolean; - procedure BrowseDir(Dir: string); // Browse a dir + subdirs for songfiles - end; - - var Songs: TSongs; - -implementation -uses Sysutils, UMainForm, Dialogs; - -function TSongs.ReadHeader(var rSong: TSong): boolean; -var - Line, Identifier, Value: String; - Temp: word; - Done: byte; - SongFile: Textfile; -begin - Result := False; - - - //Open File and set File Pointer to the beginning - AssignFile(SongFile, rSong.Path + rSong.FileName); - Reset(SongFile); - - //Read Header - Result := true; - - //Read first Line - ReadLn (SongFile, Line); - - if (Length(Line)<=0) then - begin - Result := False; - Exit; - end; - Done := 0; - //Read Lines while Line starts with # - While (Line[1] = '#') do - begin - Temp := Pos(':', Line); - - //Line has a Seperator-> Headerline - if (Temp <> 0) then - begin - //Read Identifier and Value - Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks - Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); - - //Check the Identifier (If Value is given) - if (Length(Value) <> 0) then - begin - - //----------- - //Required Attributes - //----------- - - //Title - if (Identifier = 'TITLE') then - begin - rSong.Title := Value; - - //Add Title Flag to Done - Done := Done or 1; - end - - //Artist - else if (Identifier = 'ARTIST') then - begin - rSong.Artist := Value; - - //Add Artist Flag to Done - Done := Done or 2; - end; - - end; - end; - - if not EOf(SongFile) then - ReadLn (SongFile, Line) - else - begin - Result := False; - break; - end; - - //End on first empty Line - if (Length(Line) = 0) then - break; - end; - - //Check if all Required Values are given - if (Done <> 3) then - begin - Result := False; - end; - - //And Close File - CloseFile(SongFile); -end; - -procedure TSongs.BrowseDir(Dir: string); -var - SR: TSearchRec; // for parsing Songs Directory - SLen: integer; -begin - if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin - repeat - if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Dir + Sr.Name + '\'); - until FindNext(SR) <> 0; - end; - FindClose(SR); - - if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin - repeat - SLen := Length(Song); - SetLength(Song, SLen + 1); - - Song[SLen].Path := Dir; - Song[SLen].FileName := SR.Name; - - if (ReadHeader(Song[SLen]) = false) then SetLength(Song, SLen); - - //update Songs Label - if LastCount <> SLen div 30 then - begin - LastCount := SLen div 30; - MainForm.UpdateLoadedSongs(Dir, SLen); - end; - - until FindNext(SR) <> 0; - end; // if FindFirst - FindClose(SR); -end; - -end. diff --git a/Tools/ScoreConverter/Umainform.dfm b/Tools/ScoreConverter/Umainform.dfm deleted file mode 100644 index a4291e7b..00000000 --- a/Tools/ScoreConverter/Umainform.dfm +++ /dev/null @@ -1,123 +0,0 @@ -object mainform: Tmainform - Left = 328 - Top = 228 - HorzScrollBar.Visible = False - VertScrollBar.Visible = False - BorderIcons = [biSystemMenu, biMinimize] - BorderStyle = bsSingle - Caption = 'Ultrastar Deluxe Score Converter' - ClientHeight = 159 - ClientWidth = 449 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - Position = poDesktopCenter - OnCreate = FormCreate - PixelsPerInch = 96 - TextHeight = 13 - object Label1: TLabel - Left = 8 - Top = 8 - Width = 60 - Height = 13 - Caption = 'SongFolder: ' - end - object lFolder: TLabel - Left = 8 - Top = 24 - Width = 29 - Height = 13 - Caption = 'Folder' - end - object Label2: TLabel - Left = 8 - Top = 48 - Width = 49 - Height = 13 - Caption = 'Database:' - end - object lDatabase: TLabel - Left = 8 - Top = 64 - Width = 46 - Height = 13 - Caption = 'Database' - end - object lDatabase2: TLabel - Left = 72 - Top = 48 - Width = 54 - Height = 13 - Caption = 'lDatabase2' - end - object lFolder2: TLabel - Left = 72 - Top = 8 - Width = 37 - Height = 13 - Caption = 'lFolder2' - end - object lStatus: TLabel - Left = 0 - Top = 96 - Width = 449 - Height = 13 - Alignment = taCenter - AutoSize = False - Caption = 'lStatus' - end - object bFLoad: TButton - Left = 176 - Top = 8 - Width = 57 - Height = 17 - Caption = 'Load' - TabOrder = 0 - OnClick = bFLoadClick - end - object bDLoad: TButton - Left = 176 - Top = 48 - Width = 57 - Height = 17 - Caption = 'Load' - TabOrder = 1 - OnClick = bDLoadClick - end - object bToDB: TButton - Left = 16 - Top = 112 - Width = 153 - Height = 17 - Caption = 'Convert *.SCO to Database' - Enabled = False - TabOrder = 2 - OnClick = bToDBClick - end - object bFromDB: TButton - Left = 288 - Top = 112 - Width = 145 - Height = 17 - Caption = 'Convert Database to *.SCO' - Enabled = False - TabOrder = 3 - OnClick = bFromDBClick - end - object pProgress: TProgressBar - Left = 8 - Top = 136 - Width = 433 - Height = 17 - TabOrder = 4 - end - object oDatabase: TOpenDialog - Filter = 'Ultrastar Deluxe Database|ultrastar.db' - Left = 136 - Top = 48 - end -end diff --git a/Tools/ScoreConverter/Umainform.pas b/Tools/ScoreConverter/Umainform.pas deleted file mode 100644 index 647cf3a4..00000000 --- a/Tools/ScoreConverter/Umainform.pas +++ /dev/null @@ -1,230 +0,0 @@ -unit Umainform; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls, ComCtrls, UDataBase, ShellAPI, ShlObj, USongs; - -type - Tmainform = class(TForm) - Label1: TLabel; - lFolder: TLabel; - bFLoad: TButton; - Label2: TLabel; - lDatabase: TLabel; - bDLoad: TButton; - lDatabase2: TLabel; - lFolder2: TLabel; - bToDB: TButton; - bFromDB: TButton; - pProgress: TProgressBar; - oDatabase: TOpenDialog; - lStatus: TLabel; - procedure FormCreate(Sender: TObject); - procedure bDLoadClick(Sender: TObject); - function BrowseDialog (const Title: string; const Flag: integer): string; - procedure bFLoadClick(Sender: TObject); - procedure UpdateLoadedSongs(Path: String; Count: integer); - procedure bToDBClick(Sender: TObject); - procedure bFromDBClick(Sender: TObject); - private - { Private-Deklarationen } - public - { Public-Deklarationen } - end; - -var - mainform: Tmainform; - DBLoaded: Boolean; - SFLoaded: Boolean; - - -implementation - -uses UScores; - -{$R *.dfm} - -function Tmainform.BrowseDialog - (const Title: string; const Flag: integer): string; -var - lpItemID : PItemIDList; - BrowseInfo : TBrowseInfo; - DisplayName : array[0..MAX_PATH] of char; - TempPath : array[0..MAX_PATH] of char; -begin - Result:=''; - FillChar(BrowseInfo, sizeof(TBrowseInfo), #0); - with BrowseInfo do begin - hwndOwner := Application.Handle; - pszDisplayName := @DisplayName; - lpszTitle := PChar(Title); - ulFlags := Flag; - end; - lpItemID := SHBrowseForFolder(BrowseInfo); - if lpItemId <> nil then begin - SHGetPathFromIDList(lpItemID, TempPath); - Result := TempPath; - GlobalFreePtr(lpItemID); - end; -end; - -procedure Tmainform.FormCreate(Sender: TObject); -begin - Database := TDataBaseSystem.Create; - Songs := TSongs.Create; - lStatus.Caption := 'Welcome to USD Score Converter'; - lFolder2.Caption := 'No Songs loaded'; - lFolder.Caption := ''; - lDataBase2.Caption := 'No Database loaded'; - lDataBase.Caption := ''; -end; - -procedure Tmainform.bDLoadClick(Sender: TObject); -begin - if oDatabase.Execute then - begin - try - Database.Init(oDataBase.FileName); - lDataBase2.Caption := 'Database loaded'; - lDataBase.Caption := oDataBase.FileName; - DBLoaded := True; - except - lDataBase2.Caption := 'No Database loaded'; - lDataBase.Caption := ''; - DBLoaded := False; - end; - end; - bToDB.Enabled := DBLoaded and SFLoaded; - bFromDB.Enabled := bToDB.Enabled; -end; - -procedure Tmainform.bFLoadClick(Sender: TObject); -var - Path: String; -begin - Path := BrowseDialog('Select UltraStar SongFolder', BIF_RETURNONLYFSDIRS); - - if Path <> '' then - begin - SetLength(Songs.Song, 0); - try - Songs.BrowseDir(Path + '\'); - lFolder2.Caption := Inttostr(Length(Songs.Song)) + ' Songs loaded'; - lFolder.Caption := Path; - SFLoaded := True; - except - lFolder2.Caption := 'No Songs loaded'; - lFolder.Caption := ''; - SFLoaded := False; - end; - end; - - bToDB.Enabled := DBLoaded and SFLoaded; - bFromDB.Enabled := bToDB.Enabled; -end; - -procedure Tmainform.UpdateLoadedSongs(Path: String; Count: integer); -begin - lFolder2.Caption := Inttostr(Count) + ' Songs loaded'; - lFolder.Caption := Path; - Application.ProcessMessages; -end; - -procedure Tmainform.bToDBClick(Sender: TObject); -var - I, J, K: Integer; - LastI: integer; -begin - if (Messagebox(0, PChar('If the same directory is added more than one time the Score-File will be useless. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then - begin - pProgress.Max := high(Songs.Song); - pProgress.Position := 0; - // Go through all Songs - For I := 0 to high(Songs.Song) do - begin - try - //Read Scores from .SCO File - ReadScore (Songs.Song[I]); - - //Go from Easy to Difficult - For J := 0 to 2 do - begin - //Go through all Score Entrys with Difficulty J - For K := 0 to high(Songs.Song[I].Score[J]) do - begin - //Add to DataBase - DataBase.AddScore(Songs.Song[I], J, Songs.Song[I].Score[J][K].Name, Songs.Song[I].Score[J][K].Score); - end; - end; - - except - showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName); - end; - - //Update ProgressBar - J := I div 30; - if (LastI <> J) then - begin - LastI := J; - pProgress.Position := I; - lStatus.Caption := 'Adding Songscore: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title; - Application.ProcessMessages; - end; - end; - - pProgress.Position := pProgress.Max; - lStatus.Caption := 'Finished'; - end; -end; - -procedure Tmainform.bFromDBClick(Sender: TObject); -var - I, J: Integer; - LastI: integer; - anyScoreinthere: boolean; -begin - if (Messagebox(0, PChar('All Score Entrys in the Song Directory having an equivalent will be Overwritten. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then - begin - pProgress.Max := high(Songs.Song); - pProgress.Position := 0; - // Go through all Songs - For I := 0 to high(Songs.Song) do - begin - try - //Not Write ScoreFile when there are no Scores for this File - anyScoreinthere := false; - //Read Scores from DB File - Database.ReadScore (Songs.Song[I]); - - //Go from Easy to Difficult - For J := 0 to 2 do - begin - anyScoreinthere := anyScoreinthere or (Length(Songs.Song[I].Score[J]) > 0); - end; - - if AnyScoreinThere then - WriteScore(Songs.Song[I]); - - except - showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName); - end; - - //Update ProgressBar - J := I div 30; - if (LastI <> J) then - begin - LastI := J; - pProgress.Position := I; - lStatus.Caption := 'Writing ScoreFile: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title; - Application.ProcessMessages; - end; - end; - - pProgress.Position := pProgress.Max; - lStatus.Caption := 'Finished'; - end; -end; - -end. diff --git a/artwork/usdx_icon.svg b/artwork/usdx_icon.svg new file mode 100644 index 00000000..49719bba --- /dev/null +++ b/artwork/usdx_icon.svg @@ -0,0 +1,4001 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + File Manager + + + Jakub Steiner + + + http://jimmac.musichall.cz + + + file + manager + copy + move + filesystem + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/5000Points/Until5000.dpr b/plugins/5000Points/Until5000.dpr new file mode 100644 index 00000000..507159ff --- /dev/null +++ b/plugins/5000Points/Until5000.dpr @@ -0,0 +1,97 @@ +library Until5000; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I ../../Game/Code/switches.inc} + +uses + ModiSDK in '..\SDK\ModiSDK.pas'; + +//Gave the Plugins Info +procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +begin + Info.Name := 'PLUGIN_UNTIL5000_NAME'; + + Info.Creator := 'Whiteshark'; + Info.PluginDesc := 'PLUGIN_UNTIL5000_DESC'; + + //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 := 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 +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} +begin +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} +var +I: Integer; +begin +Result := False; + for I := 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 + Exit; + end; +Result := True; +end; + +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +var + I:Integer; +begin +Result := 0; +for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if (PlayerInfo.Playerinfo[I].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; + end; + end; + end; +end; + +exports +PluginInfo, Init, Draw, Finish; + +begin + +end. \ No newline at end of file diff --git a/plugins/Blind/Blind.dpr b/plugins/Blind/Blind.dpr new file mode 100644 index 00000000..2f94229c --- /dev/null +++ b/plugins/Blind/Blind.dpr @@ -0,0 +1,102 @@ +library Blind; + +uses + ModiSDK in '..\SDK\ModiSDK.pas'; + +//Gave the Plugins Info +procedure PluginInfo (var Info: TPluginInfo); stdcall; +begin + Info.Name := 'PLUGIN_BLIND_NAME'; + + Info.Creator := 'Whiteshark'; + Info.PluginDesc := 'PLUGIN_BLIND_DESC'; + + //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 := 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.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_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 +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; +begin +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; +begin +Result := True; +end; + +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +var + I:Integer; + MaxScore: Word; +begin + Result := 0; + MaxScore := 0; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (PlayerInfo.Playerinfo[I].Score > MaxScore) then + begin + MaxScore := PlayerInfo.Playerinfo[I].Score; + Case I of + 0: Result := 1; + 1: Result := 2; + 2: Result := 4; + 3: Result := 8; + 4: Result := 16; + 5: Result := 32; + end; + end + else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; + end; + end; + end; + //If everybody has 0 Points nobody Wins + If (MaxScore = 0) then + Result := 0; +end; + +exports +PluginInfo, Init, Draw, Finish; + +begin + +end. \ No newline at end of file diff --git a/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/plugins/Don't_Get_Worse/Hold_The_Line.dpr new file mode 100644 index 00000000..a197d51b --- /dev/null +++ b/plugins/Don't_Get_Worse/Hold_The_Line.dpr @@ -0,0 +1,212 @@ +library Hold_The_Line; + +uses + ModiSDK in '..\SDK\ModiSDK.pas', + StrUtils in '..\SDK\StrUtils.pas', + OpenGL12, + Windows; + +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; +begin + Info.Name := 'PLUGIN_HDL_NAME'; + + Info.Creator := 'Whiteshark'; + Info.PluginDesc := 'PLUGIN_HDL_DESC'; + + //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 +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; +var + I: Integer; + Texname: PChar; + TexType: TTextureType; +begin + TexName := CreateStr(PChar('HDL_Pointer')); + TexType := TEXTURE_TYPE_TRANSPARENT; + PointerTex := Methods.LoadTex(TexName, TexType); + + FreeStr(TexName); + + TexName := CreateStr(PChar('dismissed.mp3')); + DismissedSound := Methods.LoadSound (TexName); + FreeStr(TexName); + + CountSentences := Sentences.High; + Limit := 0; + Frame := 0; + + MethodRec := Methods; + + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Enabled := True; + PlayerInfo.Playerinfo[I].Percentage := 100; + PlayerTimes[I] := 0; + end; + + LoadOpenGL; + + 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; + L: Byte; + C: Byte; + Text: PChar; + Blink: Boolean; + tick: Cardinal; +begin + //Aktivate Blink + If (CurSentence = CountSentences div 5 * 2 - 1) OR (CurSentence = CountSentences div 3 * 2 - 1) then + begin + Tick := Gettickcount div 400; + If (Tick <> LastTick) then + begin + LastTick := Tick; + PointerVisible := Not PointerVisible; + end; + end + else + PointerVisible := True; + + //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 + Inc(Limit); + + case Limit of + 0: L := 20; + 1: L := 50; + 2: L := 75; + end; + + C:= 0; + + Result := True; + + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + if PlayerInfo.Playerinfo[I].Enabled then + begin + if PlayerInfo.Playerinfo[I].Bar < L then + begin + PlayerInfo.Playerinfo[I].Enabled := False; + Inc(C); + PlayerTimes[I] := CurSentence; //Save Time of Dismission + //PlaySound + MethodRec.PlaySound (DismissedSound); + end; + + //Draw Pointer + if (PointerVisible) then + begin + glColor4f (0.2, 0.8, 0.1, 1); + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + 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); + glEnd; + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + end; + + end + else + begin + Inc(C); + //Draw Dismissed + Text := CreateStr(PChar('PARTY_DISMISSED')); + + glColor4f (0.8, 0.8, 0.8, 1); + + MethodRec.Print (1, 6, PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY-8, Text); + FreeStr(Text); + end; + end; + if (C >= PlayerInfo.NumPlayers-1) then + Result := False; +end; + +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +var + I:Integer; +begin +Result := 0; +for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Percentage := (PlayerTimes[I] * 100) div CountSentences; + if (PlayerInfo.Playerinfo[I].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; + end; + end; + end; +end; + +exports +PluginInfo, Init, Draw, Finish; + +begin + +end. diff --git a/plugins/Duell/Duell.dpr b/plugins/Duell/Duell.dpr new file mode 100644 index 00000000..3aff4d3e --- /dev/null +++ b/plugins/Duell/Duell.dpr @@ -0,0 +1,99 @@ +library Duell; + +uses + ModiSDK in '..\SDK\ModiSDK.pas'; + +//Gave the Plugins Info +procedure PluginInfo (var Info: TPluginInfo); stdcall; +begin + Info.Name := 'PLUGIN_DUELL_NAME'; + + Info.Creator := 'Whiteshark'; + Info.PluginDesc := 'PLUGIN_DUELL_DESC'; + + 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:= 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_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 +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; +begin +Result := True; +end; + +//Executed everytime the Screen is Drawed //If False The Game finishes +function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; +begin +Result := True; +end; + +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +var + I:Integer; + MaxScore: Word; +begin + Result := 0; + MaxScore := 0; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (PlayerInfo.Playerinfo[I].Score > MaxScore) then + begin + MaxScore := PlayerInfo.Playerinfo[I].Score; + Case I of + 0: Result := 1; + 1: Result := 2; + 2: Result := 4; + 3: Result := 8; + 4: Result := 16; + 5: Result := 32; + end; + end + else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; + end; + end; + end; + + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Result := 0; +end; + +exports +PluginInfo, Init, Draw, Finish; + +begin + +end. \ No newline at end of file diff --git a/plugins/SDK/Hooks.txt b/plugins/SDK/Hooks.txt new file mode 100644 index 00000000..999f552f --- /dev/null +++ b/plugins/SDK/Hooks.txt @@ -0,0 +1,20 @@ +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/plugins/SDK/ModiSDK.pas b/plugins/SDK/ModiSDK.pas new file mode 100644 index 00000000..76dcf8ea --- /dev/null +++ b/plugins/SDK/ModiSDK.pas @@ -0,0 +1,156 @@ +unit ModiSDK; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +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 + + //Plugin Typ, atm: 8 only for PartyMode Modi + 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 + ); + + end; + + TPlayerInfo = record + 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 + end; + end; + + TTeamInfo = record + NumTeams: Byte; + Teaminfo: array[0..5] of record + Name: PChar; + Score: Word; + Joker: Byte; + CurPlayer: Byte; + NumPlayers: Byte; + Playerinfo: array[0..3] of record + Name: PChar; + TimesPlayed: Byte; + + end; + end; + end; + + TsmallTexture = record + 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 + Start: integer; + StartNote: integer; + Lyric: string; + LyricWidth: real; + End_: integer; + BaseNote: integer; + HighNote: integer; + IlNut: integer; + TotalNotes: integer; + Note: array of record + Color: integer; + Start: integer; + Length: integer; + Tone: integer; + //Text: string; + FreeStyle: boolean; + Typ: integer; // zwykla nuta x1, zlota nuta x2 + end; + end; + end; + + DWORD = Longword; + HSTREAM = DWORD; + + TTextureType = ( + TEXTURE_TYPE_PLAIN, // Plain (alpha = 1) + TEXTURE_TYPE_TRANSPARENT, // Alpha is used + 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 + + TMethodRec = record + LoadTex: fModi_LoadTex; + Print: fModi_Print; + 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; + +implementation + +end. diff --git a/plugins/SDK/Plugin DLL Exports.txt b/plugins/SDK/Plugin DLL Exports.txt new file mode 100644 index 00000000..930e18ac --- /dev/null +++ b/plugins/SDK/Plugin DLL Exports.txt @@ -0,0 +1,11 @@ +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/plugins/SDK/Services.txt b/plugins/SDK/Services.txt new file mode 100644 index 00000000..8db031d8 --- /dev/null +++ b/plugins/SDK/Services.txt @@ -0,0 +1,22 @@ +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/plugins/SDK/StrUtils.pas b/plugins/SDK/StrUtils.pas new file mode 100644 index 00000000..a5735b8f --- /dev/null +++ b/plugins/SDK/StrUtils.pas @@ -0,0 +1,73 @@ +unit StrUtils; + +interface + +{$I switches.inc} + +uses ModiSDK; + +//function StrToAChar(Str: String): AChar; +function CreateStr(Str: PChar): PChar; +procedure FreeStr(Str: PChar); + +implementation + +{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. \ No newline at end of file diff --git a/plugins/SDK/UPartyDefs.pas b/plugins/SDK/UPartyDefs.pas new file mode 100644 index 00000000..09f97812 --- /dev/null +++ b/plugins/SDK/UPartyDefs.pas @@ -0,0 +1,189 @@ +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/plugins/SDK/UPluginDefs.pas b/plugins/SDK/UPluginDefs.pas new file mode 100644 index 00000000..4cd094f7 --- /dev/null +++ b/plugins/SDK/UPluginDefs.pas @@ -0,0 +1,195 @@ +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 64Bit addresses in 64 Bit Systems(FreePascal) + {$ENDIF} + //wParam is mainly used for Ordninals + //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 VersiontoSting(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 VersiontoSting(const Version: DWord): String; +begin // to-do : Write VersiontoString without SysUtils depencies + //Result := InttoStr((ver and $FF000000) shr 24); + Result := '1.0.1' +end; + +end. diff --git a/plugins/Team_Duell/TeamDuell.dpr b/plugins/Team_Duell/TeamDuell.dpr new file mode 100644 index 00000000..20db2b2e --- /dev/null +++ b/plugins/Team_Duell/TeamDuell.dpr @@ -0,0 +1,237 @@ +library TeamDuell ; + +uses + ModiSDK in '..\SDK\ModiSDK.pas', + StrUtils in '..\SDK\StrUtils.pas', + sysutils, + OpenGL12, + Windows; + +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; +begin + Info.Name := 'PLUGIN_TEAMDUELL_NAME'; + + Info.Creator := 'jekatt'; + Info.PluginDesc := 'PLUGIN_TEAMDUELL_DESC'; + + 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 +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; +var +I,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; + end; + // Get Teams and Players + for I := 0 to TeamInfo.NumTeams-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) ; + end; + ChangeOnSentence := 8; + starttick := GetTickCount; + firsttime := true; + secondtime := true; + bps := 1; + MethodRec := Methods; + LoadOpenGL; + 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,timeline,x,y: Integer; + display: PChar; + start: boolean; +begin + // TickCount(firstSentence) (not zero!) + If (CurSentence = ChangeOnSentence - 7) AND (firsttime) then + begin + firsttime := false; + starttick := GetTickCount; + end; + start := false; + // show first singers for 5sec + if (CurSentence < 1) AND ((starttick + 5000) > GetTickCount) then begin start := true; end; + + // TickCount(thirdSentence) + If (CurSentence = 3) AND (secondtime) then + begin + secondtime := false; + firsttime := true; + endtick := GetTickCount; + bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond + end; + + // Time to next Change + RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTickCount - starttick) / 1000); + TtoNextChange := Trunc(RTtoNextChange) +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]; + repeat + NextSinger[I] := random(SPT[I]); + until NOT(NextSinger[I] = CurSinger[I]) OR (SPT[I] = 1) ; + end; + + // display bg + 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'; + + // 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); + 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, 6, PlayerInfo.Playerinfo[I].PosX+85, PlayerInfo.Playerinfo[I].PosY+10, CreateStr(PChar(IntToStr(Trunc(TtoNextChange))))); + 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, 6, PlayerInfo.Playerinfo[I].PosX+5, PlayerInfo.Playerinfo[I].PosY+10, display); + end; + if (CurSentence = ChangeOnSentence) then begin ChangeOnSentence := CurSentence + 7; firsttime := true; end; +Result := True; +end; + +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; +var + I:Integer; + MaxScore: Word; +begin + Result := 0; + MaxScore := 0; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (PlayerInfo.Playerinfo[I].Score > MaxScore) then + begin + MaxScore := PlayerInfo.Playerinfo[I].Score; + Case I of + 0: Result := 1; + 1: Result := 2; + 2: Result := 4; + 3: Result := 8; + 4: Result := 16; + 5: Result := 32; + end; + end + else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].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; + end; + end; + end; + + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Result := 0; +end; + +exports +PluginInfo, Init, Draw, Finish; + +begin + +end. + + diff --git a/tools/ResourceExtractor/Makefile.in b/tools/ResourceExtractor/Makefile.in new file mode 100644 index 00000000..709365d7 --- /dev/null +++ b/tools/ResourceExtractor/Makefile.in @@ -0,0 +1,19 @@ +PPC = @PPC@ +PFLAGS = -dRELEASE + +NAME = ResourceExtractor +SRC = $(NAME).pas +BIN = $(NAME)@EXEEXT@ + +.PHONY: all clean distclean + +all: $(BIN) + +clean: + rm -f $(BIN) *.o *.ppu *.rst *.compiled + +distclean: clean + rm -rf Makefile *~ *.bak __history + +$(BIN): $(SRC) + $(PPC) $(PFLAGS) -o$@ $(SRC) diff --git a/tools/ResourceExtractor/ResourceExtractor.lpi b/tools/ResourceExtractor/ResourceExtractor.lpi new file mode 100644 index 00000000..82ecf87e --- /dev/null +++ b/tools/ResourceExtractor/ResourceExtractor.lpi @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/ResourceExtractor/ResourceExtractor.pas b/tools/ResourceExtractor/ResourceExtractor.pas new file mode 100644 index 00000000..aa9cc3bc --- /dev/null +++ b/tools/ResourceExtractor/ResourceExtractor.pas @@ -0,0 +1,152 @@ +program ResourceExtractor; + +{$ifdef FPC} + {$mode delphi}{$H+} +{$endif} + +uses + Classes, + SysUtils, + StrUtils; + + +var + ResCount: integer; + OutStream: TStringList; + + +procedure Init(); +begin + OutStream := TStringList.Create(); + + OutStream.Add('const'); + // placeholder for array-header (will be filled on file-saving) + OutStream.Add(''); +end; + +procedure SaveToFile(const OutFileName: string); +begin + // add array-header + OutStream[1] := ' resources: array[0..'+IntToStr(ResCount-1)+', 0..2] of string = ('; + // add trailer + OutStream.Add(' );'); + + // save file + try + OutStream.SaveToFile(OutFileName); + except + OutStream.Free(); + raise Exception.Create('Could not save to file: "' + OutFileName + '"'); + end; + + OutStream.Free(); +end; + +function AddResource(Fields: TStringList; const RCFileDir, ResDir: string): boolean; +var + ResName, ResType, ResFile: string; +begin + if (Fields.Count < 3) or + (AnsiStartsStr('//', Fields[0])) or + (Length(Fields[2]) < 3) then + begin + Result := false; + Exit; + end; + + // add a trailing comma to the last line + if (ResCount > 0) then + OutStream[OutStream.Count-1] := OutStream[OutStream.Count-1] + ','; + + ResName := Fields[0]; + ResType := Fields[1]; + ResFile := Fields[2]; + + Writeln('ADD: [' + ResType + ':' + ResName + ' = ' +ResFile + ']'); + + // quote fields + ResName := AnsiQuotedStr(ResName, '''')+','; + ResType := AnsiQuotedStr(ResType, '''')+','; + // strip surrounding quotes of filename + ResFile := AnsiMidStr(ResFile, 2, Length(Fields[2])-2); + // now translate the resource filename (relative to the RC-file) to be relative to the resource-dir + // 1st step: get absolute path of the resource + ResFile := ExpandFileName(RCFileDir + ResFile); + // 2nd step: get path of the resource relative to the resource-dir + // Note: both paths must be absolute and the base-path must have a trailing '/' or '\' + ResFile := ExtractRelativepath(ResDir, ResFile); + // 3rd step: ... and quote + ResFile := AnsiQuotedStr(ResFile, ''''); + + // compose line + OutStream.Add(Format(' (%-20S%-8S%S)', [ResName, ResType, ResFile])); + + Inc(ResCount); + + Result := true; +end; + +procedure ExtractResources(const InFileName, ResDir: string); +var + Fields: TStringList; + LineIndex: integer; + Lines: TStringList; + RCFileDirAbs, ResDirAbs: string; +begin + // get absolute paths + RCFileDirAbs := ExtractFilePath(ExpandFileName(InFileName)); + ResDirAbs := ExpandFileName(ResDir) + '/'; + + Lines := TStringList.Create(); + try + Lines.LoadFromFile(InFileName); + except + raise Exception.Create('Failed to open file: "' + InFileName + '"'); + end; + + Fields := TStringList.Create(); + for LineIndex := 0 to Lines.Count-1 do + begin + Fields.Clear(); + // split line into [Name, Type, File] + ExtractStrings([' ', #9], [], PChar(Lines[LineIndex]), Fields); + if (not AddResource(Fields, RCFileDirAbs, ResDirAbs)) then + Writeln( 'SKIP: "'+Lines[LineIndex]+'"'); + end; + + Lines.Free(); + Fields.Free(); +end; + +var + ProgName: string; +begin + if (ParamCount <> 3) then + begin + ProgName := ExtractFileName(ParamStr(0)); + WriteLn('Usage: ' + ProgName + ' RC-File Resource-Dir Output-File'); + Exit; + end; + + WriteLn('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); + WriteLn('Converting "' + ParamStr(1) + '" to "' + ParamStr(3) + '"'); + WriteLn('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); + + try + Init(); + ExtractResources(ParamStr(1), ParamStr(2)); + SaveToFile(ParamStr(3)); + except on E:Exception do + begin + WriteLn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + WriteLn('Conversion failed: ' + E.Message + '!'); + WriteLn('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + Exit; + end; + end; + + WriteLn('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'); + WriteLn('Conversion finished!'); + WriteLn('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<'); +end. + diff --git a/tools/ScoreConverter/ScoreConverter.dpr b/tools/ScoreConverter/ScoreConverter.dpr new file mode 100644 index 00000000..2774cde4 --- /dev/null +++ b/tools/ScoreConverter/ScoreConverter.dpr @@ -0,0 +1,17 @@ +program ScoreConverter; + +uses + Forms, + Umainform in 'Umainform.pas' {mainform}, + UScores in 'UScores.pas', + UDataBase in '..\Game\Code\Classes\UDataBase.pas', + USongs in 'USongs.pas'; + +{$R *.res} + +begin + Application.Initialize; + Application.Title := 'Score Converter'; + Application.CreateForm(Tmainform, mainform); + Application.Run; +end. diff --git a/tools/ScoreConverter/ScoreConverter.ico b/tools/ScoreConverter/ScoreConverter.ico new file mode 100644 index 00000000..80319014 Binary files /dev/null and b/tools/ScoreConverter/ScoreConverter.ico differ diff --git a/tools/ScoreConverter/ScoreConverter.res b/tools/ScoreConverter/ScoreConverter.res new file mode 100644 index 00000000..2d3bea87 Binary files /dev/null and b/tools/ScoreConverter/ScoreConverter.res differ diff --git a/tools/ScoreConverter/UScores.pas b/tools/ScoreConverter/UScores.pas new file mode 100644 index 00000000..801d796e --- /dev/null +++ b/tools/ScoreConverter/UScores.pas @@ -0,0 +1,102 @@ +unit UScores; + +interface + +uses USongs; + +procedure ReadScore(var Song: TSong); +procedure WriteScore(var Song: TSong); +procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); + +implementation + +uses IniFiles, SysUtils; + +procedure ReadScore(var Song: TSong); +var + F: TIniFile; + S: string; + P: integer; + Lev: integer; + LevS: string; +begin + F := TIniFile.Create(Song.Path + ChangeFileExt(Song.FileName, '.sco')); + + for Lev := 0 to 2 do begin + case Lev of + 0: LevS := 'Easy'; + 1: LevS := 'Normal'; + 2: LevS := 'Hard'; + end; + + P := 1; + S := F.ReadString(LevS + IntToStr(P), 'Name', ''); + while (S <> '') and (P<=5) do begin + SetLength(Song.Score[Lev], P); + Song.Score[Lev, P-1].Name := S; + Song.Score[Lev, P-1].Score := F.ReadInteger(LevS + IntToStr(P), 'Score', 0); + + Inc(P); + S := F.ReadString(LevS + IntToStr(P), 'Name', ''); + end; + end; +end; + +procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +var + S: integer; + S2: integer; +begin + S := 0; + while (S <= High(Song.Score[Level])) and (Score <= Song.Score[Level, S].Score) do + Inc(S); + // S has the number for new score + + + // we create new score + SetLength(Song.Score[Level], Length(Song.Score[Level]) + 1); + + // we move down old scores + for S2 := High(Song.Score[Level])-1 downto S do + Song.Score[Level, S2+1] := Song.Score[Level, S2]; + + // we fill new score + Song.Score[Level, S].Name := Name; + Song.Score[Level, S].Score := Score; + + if Length(Song.Score[Level]) > 5 then begin + SetLength(Song.Score[Level], 5); + end; +end; + +procedure WriteScore(var Song: TSong); +var + F: TIniFile; + S: integer; + Lev: integer; + LevS: string; + FileName: string; +begin + FileName := Song.Path + ChangeFileExt(Song.FileName, '.sco'); + if (not FileExists(FileName)) or (FileExists(FileName) and DeleteFile(FileName)) then begin + // file has been deleted -> creating new file + F := TIniFile.Create(FileName); + + for Lev := 0 to 2 do begin + case Lev of + 0: LevS := 'Easy'; + 1: LevS := 'Normal'; + 2: LevS := 'Hard'; + end; + + for S := 0 to high(Song.Score[Lev]) do begin + F.WriteString(LevS + IntToStr(S+1), 'Name', Song.Score[Lev, S].Name); + F.WriteInteger(LevS + IntToStr(S+1), 'Score', Song.Score[Lev, S].Score); + + end; // for S + end; // for Lev + F.Free; + end; // if +end; + +end. diff --git a/tools/ScoreConverter/USongs.pas b/tools/ScoreConverter/USongs.pas new file mode 100644 index 00000000..8f20f44f --- /dev/null +++ b/tools/ScoreConverter/USongs.pas @@ -0,0 +1,160 @@ +unit USongs; + +interface + +type + TScore = record + Name: string; + Score: integer; + Length: string; + end; + + TSong = record + Path: string; + FileName: string; + + Title: string; + Artist: string; + + Score: array[0..2] of array of TScore; + end; + + TSongs = class + LastCount: Integer; + Song: array of TSong; // array of songs + + function ReadHeader(var rSong: TSong): boolean; + procedure BrowseDir(Dir: string); // Browse a dir + subdirs for songfiles + end; + + var Songs: TSongs; + +implementation +uses Sysutils, UMainForm, Dialogs; + +function TSongs.ReadHeader(var rSong: TSong): boolean; +var + Line, Identifier, Value: String; + Temp: word; + Done: byte; + SongFile: Textfile; +begin + Result := False; + + + //Open File and set File Pointer to the beginning + AssignFile(SongFile, rSong.Path + rSong.FileName); + Reset(SongFile); + + //Read Header + Result := true; + + //Read first Line + ReadLn (SongFile, Line); + + if (Length(Line)<=0) then + begin + Result := False; + Exit; + end; + Done := 0; + //Read Lines while Line starts with # + While (Line[1] = '#') do + begin + Temp := Pos(':', Line); + + //Line has a Seperator-> Headerline + if (Temp <> 0) then + begin + //Read Identifier and Value + Identifier := Uppercase(Trim(Copy(Line, 2, Temp - 2))); //Uppercase is for Case Insensitive Checks + Value := Trim(Copy(Line, Temp + 1,Length(Line) - Temp)); + + //Check the Identifier (If Value is given) + if (Length(Value) <> 0) then + begin + + //----------- + //Required Attributes + //----------- + + //Title + if (Identifier = 'TITLE') then + begin + rSong.Title := Value; + + //Add Title Flag to Done + Done := Done or 1; + end + + //Artist + else if (Identifier = 'ARTIST') then + begin + rSong.Artist := Value; + + //Add Artist Flag to Done + Done := Done or 2; + end; + + end; + end; + + if not EOf(SongFile) then + ReadLn (SongFile, Line) + else + begin + Result := False; + break; + end; + + //End on first empty Line + if (Length(Line) = 0) then + break; + end; + + //Check if all Required Values are given + if (Done <> 3) then + begin + Result := False; + end; + + //And Close File + CloseFile(SongFile); +end; + +procedure TSongs.BrowseDir(Dir: string); +var + SR: TSearchRec; // for parsing Songs Directory + SLen: integer; +begin + if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin + repeat + if (SR.Name <> '.') and (SR.Name <> '..') then + BrowseDir(Dir + Sr.Name + '\'); + until FindNext(SR) <> 0; + end; + FindClose(SR); + + if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin + repeat + SLen := Length(Song); + SetLength(Song, SLen + 1); + + Song[SLen].Path := Dir; + Song[SLen].FileName := SR.Name; + + if (ReadHeader(Song[SLen]) = false) then SetLength(Song, SLen); + + //update Songs Label + if LastCount <> SLen div 30 then + begin + LastCount := SLen div 30; + MainForm.UpdateLoadedSongs(Dir, SLen); + end; + + until FindNext(SR) <> 0; + end; // if FindFirst + FindClose(SR); +end; + +end. diff --git a/tools/ScoreConverter/Umainform.dfm b/tools/ScoreConverter/Umainform.dfm new file mode 100644 index 00000000..a4291e7b --- /dev/null +++ b/tools/ScoreConverter/Umainform.dfm @@ -0,0 +1,123 @@ +object mainform: Tmainform + Left = 328 + Top = 228 + HorzScrollBar.Visible = False + VertScrollBar.Visible = False + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'Ultrastar Deluxe Score Converter' + ClientHeight = 159 + ClientWidth = 449 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + Position = poDesktopCenter + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 8 + Width = 60 + Height = 13 + Caption = 'SongFolder: ' + end + object lFolder: TLabel + Left = 8 + Top = 24 + Width = 29 + Height = 13 + Caption = 'Folder' + end + object Label2: TLabel + Left = 8 + Top = 48 + Width = 49 + Height = 13 + Caption = 'Database:' + end + object lDatabase: TLabel + Left = 8 + Top = 64 + Width = 46 + Height = 13 + Caption = 'Database' + end + object lDatabase2: TLabel + Left = 72 + Top = 48 + Width = 54 + Height = 13 + Caption = 'lDatabase2' + end + object lFolder2: TLabel + Left = 72 + Top = 8 + Width = 37 + Height = 13 + Caption = 'lFolder2' + end + object lStatus: TLabel + Left = 0 + Top = 96 + Width = 449 + Height = 13 + Alignment = taCenter + AutoSize = False + Caption = 'lStatus' + end + object bFLoad: TButton + Left = 176 + Top = 8 + Width = 57 + Height = 17 + Caption = 'Load' + TabOrder = 0 + OnClick = bFLoadClick + end + object bDLoad: TButton + Left = 176 + Top = 48 + Width = 57 + Height = 17 + Caption = 'Load' + TabOrder = 1 + OnClick = bDLoadClick + end + object bToDB: TButton + Left = 16 + Top = 112 + Width = 153 + Height = 17 + Caption = 'Convert *.SCO to Database' + Enabled = False + TabOrder = 2 + OnClick = bToDBClick + end + object bFromDB: TButton + Left = 288 + Top = 112 + Width = 145 + Height = 17 + Caption = 'Convert Database to *.SCO' + Enabled = False + TabOrder = 3 + OnClick = bFromDBClick + end + object pProgress: TProgressBar + Left = 8 + Top = 136 + Width = 433 + Height = 17 + TabOrder = 4 + end + object oDatabase: TOpenDialog + Filter = 'Ultrastar Deluxe Database|ultrastar.db' + Left = 136 + Top = 48 + end +end diff --git a/tools/ScoreConverter/Umainform.pas b/tools/ScoreConverter/Umainform.pas new file mode 100644 index 00000000..647cf3a4 --- /dev/null +++ b/tools/ScoreConverter/Umainform.pas @@ -0,0 +1,230 @@ +unit Umainform; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ComCtrls, UDataBase, ShellAPI, ShlObj, USongs; + +type + Tmainform = class(TForm) + Label1: TLabel; + lFolder: TLabel; + bFLoad: TButton; + Label2: TLabel; + lDatabase: TLabel; + bDLoad: TButton; + lDatabase2: TLabel; + lFolder2: TLabel; + bToDB: TButton; + bFromDB: TButton; + pProgress: TProgressBar; + oDatabase: TOpenDialog; + lStatus: TLabel; + procedure FormCreate(Sender: TObject); + procedure bDLoadClick(Sender: TObject); + function BrowseDialog (const Title: string; const Flag: integer): string; + procedure bFLoadClick(Sender: TObject); + procedure UpdateLoadedSongs(Path: String; Count: integer); + procedure bToDBClick(Sender: TObject); + procedure bFromDBClick(Sender: TObject); + private + { Private-Deklarationen } + public + { Public-Deklarationen } + end; + +var + mainform: Tmainform; + DBLoaded: Boolean; + SFLoaded: Boolean; + + +implementation + +uses UScores; + +{$R *.dfm} + +function Tmainform.BrowseDialog + (const Title: string; const Flag: integer): string; +var + lpItemID : PItemIDList; + BrowseInfo : TBrowseInfo; + DisplayName : array[0..MAX_PATH] of char; + TempPath : array[0..MAX_PATH] of char; +begin + Result:=''; + FillChar(BrowseInfo, sizeof(TBrowseInfo), #0); + with BrowseInfo do begin + hwndOwner := Application.Handle; + pszDisplayName := @DisplayName; + lpszTitle := PChar(Title); + ulFlags := Flag; + end; + lpItemID := SHBrowseForFolder(BrowseInfo); + if lpItemId <> nil then begin + SHGetPathFromIDList(lpItemID, TempPath); + Result := TempPath; + GlobalFreePtr(lpItemID); + end; +end; + +procedure Tmainform.FormCreate(Sender: TObject); +begin + Database := TDataBaseSystem.Create; + Songs := TSongs.Create; + lStatus.Caption := 'Welcome to USD Score Converter'; + lFolder2.Caption := 'No Songs loaded'; + lFolder.Caption := ''; + lDataBase2.Caption := 'No Database loaded'; + lDataBase.Caption := ''; +end; + +procedure Tmainform.bDLoadClick(Sender: TObject); +begin + if oDatabase.Execute then + begin + try + Database.Init(oDataBase.FileName); + lDataBase2.Caption := 'Database loaded'; + lDataBase.Caption := oDataBase.FileName; + DBLoaded := True; + except + lDataBase2.Caption := 'No Database loaded'; + lDataBase.Caption := ''; + DBLoaded := False; + end; + end; + bToDB.Enabled := DBLoaded and SFLoaded; + bFromDB.Enabled := bToDB.Enabled; +end; + +procedure Tmainform.bFLoadClick(Sender: TObject); +var + Path: String; +begin + Path := BrowseDialog('Select UltraStar SongFolder', BIF_RETURNONLYFSDIRS); + + if Path <> '' then + begin + SetLength(Songs.Song, 0); + try + Songs.BrowseDir(Path + '\'); + lFolder2.Caption := Inttostr(Length(Songs.Song)) + ' Songs loaded'; + lFolder.Caption := Path; + SFLoaded := True; + except + lFolder2.Caption := 'No Songs loaded'; + lFolder.Caption := ''; + SFLoaded := False; + end; + end; + + bToDB.Enabled := DBLoaded and SFLoaded; + bFromDB.Enabled := bToDB.Enabled; +end; + +procedure Tmainform.UpdateLoadedSongs(Path: String; Count: integer); +begin + lFolder2.Caption := Inttostr(Count) + ' Songs loaded'; + lFolder.Caption := Path; + Application.ProcessMessages; +end; + +procedure Tmainform.bToDBClick(Sender: TObject); +var + I, J, K: Integer; + LastI: integer; +begin + if (Messagebox(0, PChar('If the same directory is added more than one time the Score-File will be useless. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then + begin + pProgress.Max := high(Songs.Song); + pProgress.Position := 0; + // Go through all Songs + For I := 0 to high(Songs.Song) do + begin + try + //Read Scores from .SCO File + ReadScore (Songs.Song[I]); + + //Go from Easy to Difficult + For J := 0 to 2 do + begin + //Go through all Score Entrys with Difficulty J + For K := 0 to high(Songs.Song[I].Score[J]) do + begin + //Add to DataBase + DataBase.AddScore(Songs.Song[I], J, Songs.Song[I].Score[J][K].Name, Songs.Song[I].Score[J][K].Score); + end; + end; + + except + showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName); + end; + + //Update ProgressBar + J := I div 30; + if (LastI <> J) then + begin + LastI := J; + pProgress.Position := I; + lStatus.Caption := 'Adding Songscore: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title; + Application.ProcessMessages; + end; + end; + + pProgress.Position := pProgress.Max; + lStatus.Caption := 'Finished'; + end; +end; + +procedure Tmainform.bFromDBClick(Sender: TObject); +var + I, J: Integer; + LastI: integer; + anyScoreinthere: boolean; +begin + if (Messagebox(0, PChar('All Score Entrys in the Song Directory having an equivalent will be Overwritten. Contėnue ?'), PChar(Mainform.Caption), MB_ICONWARNING or MB_YESNO) = IDYes) then + begin + pProgress.Max := high(Songs.Song); + pProgress.Position := 0; + // Go through all Songs + For I := 0 to high(Songs.Song) do + begin + try + //Not Write ScoreFile when there are no Scores for this File + anyScoreinthere := false; + //Read Scores from DB File + Database.ReadScore (Songs.Song[I]); + + //Go from Easy to Difficult + For J := 0 to 2 do + begin + anyScoreinthere := anyScoreinthere or (Length(Songs.Song[I].Score[J]) > 0); + end; + + if AnyScoreinThere then + WriteScore(Songs.Song[I]); + + except + showmessage ('Error Converting Score From Song: ' + Songs.Song[I].Path + Songs.Song[I].FileName); + end; + + //Update ProgressBar + J := I div 30; + if (LastI <> J) then + begin + LastI := J; + pProgress.Position := I; + lStatus.Caption := 'Writing ScoreFile: ' + Songs.Song[I].Artist + ' - ' + Songs.Song[I].Title; + Application.ProcessMessages; + end; + end; + + pProgress.Position := pProgress.Max; + lStatus.Caption := 'Finished'; + end; +end; + +end. -- cgit v1.2.3