diff options
Diffstat (limited to 'Lua/plugins')
-rw-r--r-- | Lua/plugins/5000Points/Until5000.dpr | 98 | ||||
-rw-r--r-- | Lua/plugins/Blind/Blind.dpr | 109 | ||||
-rw-r--r-- | Lua/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj | 175 | ||||
-rw-r--r-- | Lua/plugins/Don't_Get_Worse/Hold_The_Line.dpr | 215 | ||||
-rw-r--r-- | Lua/plugins/Don't_Get_Worse/Hold_The_Line.lpi | 108 | ||||
-rw-r--r-- | Lua/plugins/Don't_Get_Worse/dismissed.mp3 | bin | 0 -> 5433 bytes | |||
-rw-r--r-- | Lua/plugins/Duell/Duell.dpr | 106 | ||||
-rw-r--r-- | Lua/plugins/SDK/Hooks.txt | 20 | ||||
-rw-r--r-- | Lua/plugins/SDK/ModiSDK.pas | 154 | ||||
-rw-r--r-- | Lua/plugins/SDK/Plugin DLL Exports.txt | 11 | ||||
-rw-r--r-- | Lua/plugins/SDK/Services.txt | 22 | ||||
-rw-r--r-- | Lua/plugins/SDK/StrUtils.pas | 79 | ||||
-rw-r--r-- | Lua/plugins/SDK/UPartyDefs.pas | 189 | ||||
-rw-r--r-- | Lua/plugins/SDK/UPluginDefs.pas | 193 | ||||
-rw-r--r-- | Lua/plugins/Team_Duell/TeamDuell.dpr | 241 |
15 files changed, 1720 insertions, 0 deletions
diff --git a/Lua/plugins/5000Points/Until5000.dpr b/Lua/plugins/5000Points/Until5000.dpr new file mode 100644 index 00000000..df79bfe2 --- /dev/null +++ b/Lua/plugins/5000Points/Until5000.dpr @@ -0,0 +1,98 @@ +library Until5000; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +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/Lua/plugins/Blind/Blind.dpr b/Lua/plugins/Blind/Blind.dpr new file mode 100644 index 00000000..d2824587 --- /dev/null +++ b/Lua/plugins/Blind/Blind.dpr @@ -0,0 +1,109 @@ +library Blind; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +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/Lua/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj new file mode 100644 index 00000000..8694fb50 --- /dev/null +++ b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject>
+ <PersonalityInfo>
+ <Option>
+ <Option Name="Personality">Delphi.Personality</Option>
+ <Option Name="ProjectType">VCLApplication</Option>
+ <Option Name="Version">1.0</Option>
+ <Option Name="GUID">{06A9B812-7EBB-46A7-A56A-6DE18E64E79D}</Option>
+ </Option>
+ </PersonalityInfo>
+ <Delphi.Personality>
+ <Source>
+ <Source Name="MainSource">Hold_The_Line.dpr</Source>
+ </Source>
+ <FileVersion>
+ <FileVersion Name="Version">7.0</FileVersion>
+ </FileVersion>
+ <Compiler>
+ <Compiler Name="A">8</Compiler>
+ <Compiler Name="B">0</Compiler>
+ <Compiler Name="C">1</Compiler>
+ <Compiler Name="D">1</Compiler>
+ <Compiler Name="E">0</Compiler>
+ <Compiler Name="F">0</Compiler>
+ <Compiler Name="G">1</Compiler>
+ <Compiler Name="H">1</Compiler>
+ <Compiler Name="I">1</Compiler>
+ <Compiler Name="J">0</Compiler>
+ <Compiler Name="K">0</Compiler>
+ <Compiler Name="L">1</Compiler>
+ <Compiler Name="M">0</Compiler>
+ <Compiler Name="N">1</Compiler>
+ <Compiler Name="O">1</Compiler>
+ <Compiler Name="P">1</Compiler>
+ <Compiler Name="Q">0</Compiler>
+ <Compiler Name="R">0</Compiler>
+ <Compiler Name="S">0</Compiler>
+ <Compiler Name="T">0</Compiler>
+ <Compiler Name="U">0</Compiler>
+ <Compiler Name="V">1</Compiler>
+ <Compiler Name="W">0</Compiler>
+ <Compiler Name="X">1</Compiler>
+ <Compiler Name="Y">1</Compiler>
+ <Compiler Name="Z">1</Compiler>
+ <Compiler Name="ShowHints">True</Compiler>
+ <Compiler Name="ShowWarnings">True</Compiler>
+ <Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
+ <Compiler Name="NamespacePrefix"></Compiler>
+ <Compiler Name="GenerateDocumentation">False</Compiler>
+ <Compiler Name="DefaultNamespace"></Compiler>
+ <Compiler Name="SymbolDeprecated">True</Compiler>
+ <Compiler Name="SymbolLibrary">True</Compiler>
+ <Compiler Name="SymbolPlatform">True</Compiler>
+ <Compiler Name="SymbolExperimental">True</Compiler>
+ <Compiler Name="UnitLibrary">True</Compiler>
+ <Compiler Name="UnitPlatform">True</Compiler>
+ <Compiler Name="UnitDeprecated">True</Compiler>
+ <Compiler Name="UnitExperimental">True</Compiler>
+ <Compiler Name="HResultCompat">True</Compiler>
+ <Compiler Name="HidingMember">True</Compiler>
+ <Compiler Name="HiddenVirtual">True</Compiler>
+ <Compiler Name="Garbage">True</Compiler>
+ <Compiler Name="BoundsError">True</Compiler>
+ <Compiler Name="ZeroNilCompat">True</Compiler>
+ <Compiler Name="StringConstTruncated">True</Compiler>
+ <Compiler Name="ForLoopVarVarPar">True</Compiler>
+ <Compiler Name="TypedConstVarPar">True</Compiler>
+ <Compiler Name="AsgToTypedConst">True</Compiler>
+ <Compiler Name="CaseLabelRange">True</Compiler>
+ <Compiler Name="ForVariable">True</Compiler>
+ <Compiler Name="ConstructingAbstract">True</Compiler>
+ <Compiler Name="ComparisonFalse">True</Compiler>
+ <Compiler Name="ComparisonTrue">True</Compiler>
+ <Compiler Name="ComparingSignedUnsigned">True</Compiler>
+ <Compiler Name="CombiningSignedUnsigned">True</Compiler>
+ <Compiler Name="UnsupportedConstruct">True</Compiler>
+ <Compiler Name="FileOpen">True</Compiler>
+ <Compiler Name="FileOpenUnitSrc">True</Compiler>
+ <Compiler Name="BadGlobalSymbol">True</Compiler>
+ <Compiler Name="DuplicateConstructorDestructor">True</Compiler>
+ <Compiler Name="InvalidDirective">True</Compiler>
+ <Compiler Name="PackageNoLink">True</Compiler>
+ <Compiler Name="PackageThreadVar">True</Compiler>
+ <Compiler Name="ImplicitImport">True</Compiler>
+ <Compiler Name="HPPEMITIgnored">True</Compiler>
+ <Compiler Name="NoRetVal">True</Compiler>
+ <Compiler Name="UseBeforeDef">True</Compiler>
+ <Compiler Name="ForLoopVarUndef">True</Compiler>
+ <Compiler Name="UnitNameMismatch">True</Compiler>
+ <Compiler Name="NoCFGFileFound">True</Compiler>
+ <Compiler Name="ImplicitVariants">True</Compiler>
+ <Compiler Name="UnicodeToLocale">True</Compiler>
+ <Compiler Name="LocaleToUnicode">True</Compiler>
+ <Compiler Name="ImagebaseMultiple">True</Compiler>
+ <Compiler Name="SuspiciousTypecast">True</Compiler>
+ <Compiler Name="PrivatePropAccessor">True</Compiler>
+ <Compiler Name="UnsafeType">False</Compiler>
+ <Compiler Name="UnsafeCode">False</Compiler>
+ <Compiler Name="UnsafeCast">False</Compiler>
+ <Compiler Name="OptionTruncated">True</Compiler>
+ <Compiler Name="WideCharReduced">True</Compiler>
+ <Compiler Name="DuplicatesIgnored">True</Compiler>
+ <Compiler Name="UnitInitSeq">True</Compiler>
+ <Compiler Name="LocalPInvoke">True</Compiler>
+ <Compiler Name="MessageDirective">True</Compiler>
+ <Compiler Name="CodePage"></Compiler>
+ </Compiler>
+ <Linker>
+ <Linker Name="MapFile">0</Linker>
+ <Linker Name="OutputObjs">0</Linker>
+ <Linker Name="GenerateHpps">False</Linker>
+ <Linker Name="ConsoleApp">1</Linker>
+ <Linker Name="DebugInfo">False</Linker>
+ <Linker Name="RemoteSymbols">False</Linker>
+ <Linker Name="GenerateDRC">False</Linker>
+ <Linker Name="MinStackSize">16384</Linker>
+ <Linker Name="MaxStackSize">1048576</Linker>
+ <Linker Name="ImageBase">4194304</Linker>
+ <Linker Name="ExeDescription"></Linker>
+ </Linker>
+ <Directories>
+ <Directories Name="OutputDir"></Directories>
+ <Directories Name="UnitOutputDir"></Directories>
+ <Directories Name="PackageDLLOutputDir"></Directories>
+ <Directories Name="PackageDCPOutputDir"></Directories>
+ <Directories Name="SearchPath">..\..\src\lib\JEDI-SDL\SDL\Pas</Directories>
+ <Directories Name="Packages"></Directories>
+ <Directories Name="Conditionals"></Directories>
+ <Directories Name="DebugSourceDirs"></Directories>
+ <Directories Name="UsePackages">False</Directories>
+ </Directories>
+ <Parameters>
+ <Parameters Name="RunParams"></Parameters>
+ <Parameters Name="HostApplication"></Parameters>
+ <Parameters Name="Launcher"></Parameters>
+ <Parameters Name="UseLauncher">False</Parameters>
+ <Parameters Name="DebugCWD"></Parameters>
+ <Parameters Name="Debug Symbols Search Path"></Parameters>
+ <Parameters Name="LoadAllSymbols">True</Parameters>
+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+ </Parameters>
+ <Language>
+ <Language Name="ActiveLang"></Language>
+ <Language Name="ProjectLang">$00000000</Language>
+ <Language Name="RootDir"></Language>
+ </Language>
+ <VersionInfo>
+ <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+ <VersionInfo Name="MajorVer">1</VersionInfo>
+ <VersionInfo Name="MinorVer">0</VersionInfo>
+ <VersionInfo Name="Release">0</VersionInfo>
+ <VersionInfo Name="Build">0</VersionInfo>
+ <VersionInfo Name="Debug">False</VersionInfo>
+ <VersionInfo Name="PreRelease">False</VersionInfo>
+ <VersionInfo Name="Special">False</VersionInfo>
+ <VersionInfo Name="Private">False</VersionInfo>
+ <VersionInfo Name="DLL">False</VersionInfo>
+ <VersionInfo Name="Locale">1031</VersionInfo>
+ <VersionInfo Name="CodePage">1252</VersionInfo>
+ </VersionInfo>
+ <VersionInfoKeys>
+ <VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
+ <VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
+ <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="InternalName"></VersionInfoKeys>
+ <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
+ <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
+ <VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
+ <VersionInfoKeys Name="ProductName"></VersionInfoKeys>
+ <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="Comments"></VersionInfoKeys>
+ </VersionInfoKeys>
+ </Delphi.Personality>
+</BorlandProject>
diff --git a/Lua/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.dpr new file mode 100644 index 00000000..3ce06463 --- /dev/null +++ b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.dpr @@ -0,0 +1,215 @@ +library Hold_The_Line; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + ModiSDK in '..\SDK\ModiSDK.pas', + StrUtils in '..\SDK\StrUtils.pas', + sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', + moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; + +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; + + 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 := SDL_GetTicks() 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/Lua/plugins/Don't_Get_Worse/Hold_The_Line.lpi b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.lpi new file mode 100644 index 00000000..bb21d5d9 --- /dev/null +++ b/Lua/plugins/Don't_Get_Worse/Hold_The_Line.lpi @@ -0,0 +1,108 @@ +<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="\"/>
+ <Version Value="6"/>
+ <General>
+ <Flags>
+ <MainUnitHasUsesSectionForAllUnits Value="False"/>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
+ </Flags>
+ <MainUnit Value="0"/>
+ <TargetFileExt Value=".exe"/>
+ <Title Value="Hold_The_Line"/>
+ <ActiveEditorIndexAtStart Value="2"/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ <Language Value=""/>
+ <CharSet Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <Units Count="4">
+ <Unit0>
+ <Filename Value="Hold_The_Line.dpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="Hold_The_Line"/>
+ <CursorPos X="22" Y="1"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="0"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="..\SDK\StrUtils.pas"/>
+ <UnitName Value="StrUtils"/>
+ <CursorPos X="4" Y="13"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="2"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit1>
+ <Unit2>
+ <Filename Value="..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas"/>
+ <UnitName Value="gl"/>
+ <CursorPos X="1" Y="1"/>
+ <TopLine Value="1"/>
+ <UsageCount Value="10"/>
+ </Unit2>
+ <Unit3>
+ <Filename Value="..\SDK\ModiSDK.pas"/>
+ <UnitName Value="ModiSDK"/>
+ <CursorPos X="1" Y="8"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="1"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit3>
+ </Units>
+ <JumpHistory Count="1" HistoryIndex="0">
+ <Position1>
+ <Filename Value="..\SDK\StrUtils.pas"/>
+ <Caret Line="1" Column="1" TopLine="1"/>
+ </Position1>
+ </JumpHistory>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="8"/>
+ <PathDelim Value="\"/>
+ <SearchPaths>
+ <IncludeFiles Value="..\..\src\lib\JEDI-SDL\SDL\Pas\"/>
+ </SearchPaths>
+ <Parsing>
+ <SyntaxOptions>
+ <CStyleOperator Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
+ <Linking>
+ <Options>
+ <ExecutableType Value="Library"/>
+ </Options>
+ </Linking>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="2">
+ <Item1>
+ <Name Value="ECodetoolError"/>
+ </Item1>
+ <Item2>
+ <Name Value="EFOpenError"/>
+ </Item2>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/Lua/plugins/Don't_Get_Worse/dismissed.mp3 b/Lua/plugins/Don't_Get_Worse/dismissed.mp3 Binary files differnew file mode 100644 index 00000000..f478e7a3 --- /dev/null +++ b/Lua/plugins/Don't_Get_Worse/dismissed.mp3 diff --git a/Lua/plugins/Duell/Duell.dpr b/Lua/plugins/Duell/Duell.dpr new file mode 100644 index 00000000..93c87d0e --- /dev/null +++ b/Lua/plugins/Duell/Duell.dpr @@ -0,0 +1,106 @@ +library Duell; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +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/Lua/plugins/SDK/Hooks.txt b/Lua/plugins/SDK/Hooks.txt new file mode 100644 index 00000000..999f552f --- /dev/null +++ b/Lua/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/Lua/plugins/SDK/ModiSDK.pas b/Lua/plugins/SDK/ModiSDK.pas new file mode 100644 index 00000000..c0e66387 --- /dev/null +++ b/Lua/plugins/SDK/ModiSDK.pas @@ -0,0 +1,154 @@ +unit ModiSDK; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +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/Lua/plugins/SDK/Plugin DLL Exports.txt b/Lua/plugins/SDK/Plugin DLL Exports.txt new file mode 100644 index 00000000..930e18ac --- /dev/null +++ b/Lua/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/Lua/plugins/SDK/Services.txt b/Lua/plugins/SDK/Services.txt new file mode 100644 index 00000000..8db031d8 --- /dev/null +++ b/Lua/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/Lua/plugins/SDK/StrUtils.pas b/Lua/plugins/SDK/StrUtils.pas new file mode 100644 index 00000000..069c89c3 --- /dev/null +++ b/Lua/plugins/SDK/StrUtils.pas @@ -0,0 +1,79 @@ +unit StrUtils; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses ModiSDK; + +//function StrToAChar(Str: String): AChar; +function CreateStr(Str: PChar): PChar; +procedure FreeStr(Str: PChar); + +implementation + +{$IFDEF FPC} + {$ASMMODE Intel} +{$ENDIF} + +{function StrToAChar(Str: String): AChar; +var + L, I: Integer; +begin + L := Length(Str); + For I := 0 to L-1 do + AChar[I] := Str[I+1]; + + For I := L to 254 do + AChar[I] := #0; +end; } + +function StrCopy(Dest, Source: PChar): PChar; assembler; +asm + PUSH EDI + PUSH ESI + MOV ESI,EAX + MOV EDI,EDX + MOV ECX,0FFFFFFFFH + XOR AL,AL + REPNE SCASB + NOT ECX + MOV EDI,ESI + MOV ESI,EDX + MOV EDX,ECX + MOV EAX,EDI + SHR ECX,2 + REP MOVSD + MOV ECX,EDX + AND ECX,3 + REP MOVSB + POP ESI + POP EDI +end; + +function StrLen(Str: PChar): Cardinal; assembler; +asm + MOV EDX,EDI + MOV EDI,EAX + MOV ECX,0FFFFFFFFH + XOR AL,AL + REPNE SCASB + MOV EAX,0FFFFFFFEH + SUB EAX,ECX + MOV EDI,EDX +end; + +function CreateStr(Str: PChar): PChar; +begin + GetMem(Result, StrLen(Str) + 1); + StrCopy(Result, Str); +end; + +procedure FreeStr(Str: PChar); +begin + FreeMem(Str); +end; + +end. diff --git a/Lua/plugins/SDK/UPartyDefs.pas b/Lua/plugins/SDK/UPartyDefs.pas new file mode 100644 index 00000000..09f97812 --- /dev/null +++ b/Lua/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/Lua/plugins/SDK/UPluginDefs.pas b/Lua/plugins/SDK/UPluginDefs.pas new file mode 100644 index 00000000..45bae864 --- /dev/null +++ b/Lua/plugins/SDK/UPluginDefs.pas @@ -0,0 +1,193 @@ +unit uPluginDefs; +{********************* + uPluginDefs + Some basic structures and functions used to communicate with plugins + Usable as Delphi plugin SDK +*********************} + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +type + dword = LongWord; + + //Compatibility with 64 Bit Systems + {$IFDEF CPU32} + TwParam = integer; + TlParam = pointer; //lParam is used for 32 bit addresses. dword is large enough + {$ELSE} + TwParam = int64; + TlParam = pointer; //lParam used for 64 bit addresses in 64 bit systems (FreePascal) + {$ENDIF} + //wParam is mainly used for ordinals + //lparam is mainly used for pointers + + //---------------- + // TUS_PluginInfo - some infos from plugin to core. + // Send when Plugininfo procedure is called + // --- + // Version structure: + // First byte: Head Revison + // Second byte: Sub Revison + // Third byte: Sub Revision 2 + // Fourth byte: Letter (For Bug Fix releases. 0 or 'a' .. 'z') + //---------------- + PUS_PluginInfo = ^TUS_PluginInfo; + TUS_PluginInfo = record + cbSize: integer; //Size of this record (usefull if record will be extended in the future) + + Name: array [0..31] of char; //Name of the Plugin + Version: dword; //Version of the Plugin + Description: array [0..127] of char; //Description, what does this Plugin do + Author: array [0..31] of char; //Author of this Plugin + AuthorEmail: array [0..63] of char; //Authors Email + Homepage: array [0..63] of char; //Homepage of Plugin/Author + end; + AUS_PluginInfo = array of TUS_PluginInfo; + PAUS_PluginInfo = ^AUS_PluginInfo; + + //---------------- + // TUS_Hook - Structure of the Hook function + // Return 0 if the Hook should be continue, + // or a non zero Value, if the Hook should be Interuped + // In this Case the Caller of the Notifier gets the Return Value + // Return Value Should not be -1 + //---------------- + TUS_Hook = function (wParam: TwParam; lParam: TlParam): integer; stdcall; + TUS_Hook_of_Object = function (wParam: TwParam; lParam: TlParam): integer of Object; + + //---------------- + // TUS_Service - Structure of the Service function + // This function is called if the Registered Service is Called + // Return Value Should not be SERVICE_NOT_FOUND + //---------------- + TUS_Service = function (wParam: TwParam; lParam: TlParam): integer; stdcall; + TUS_Service_of_Object = function (wParam: TwParam; lParam: TlParam): integer of Object; + + //---------------- + // TUS_PluginInterface - Structure that Includes all Methods callable + // from the Plugins + //---------------- + PUS_PluginInterface = ^TUS_PluginInterface; + TUS_PluginInterface = record + {******** Hook specific Methods ********} + {Function Creates a new Hookable Event and Returns the Handle + or 0 on Failure. (Name already exists)} + CreateHookableEvent: function (EventName: PChar): THandle; stdcall; + + {Function Destroys an Event and Unhooks all Hooks to this Event. + 0 on success, not 0 on Failure} + DestroyHookableEvent: function (hEvent: THandle): integer; stdcall; + + {Function start calling the Hook Chain + 0 if Chain is called until the End, -1 if Event Handle is not valid + otherwise Return Value of the Hook that breaks the Chain} + NotivyEventHooks: function (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall; + + {Function Hooks an Event by Name. + Returns Hook Handle on Success, otherwise 0} + HookEvent: function (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall; + + {Function Removes the Hook from the Chain + Returns 0 on Success} + UnHookEvent: function (hHook: THandle): integer; stdcall; + + {Function Returns Non Zero if a Event with the given Name Exists, + otherwise 0} + EventExists: function (EventName: PChar): integer; stdcall; + + {******** Service specific Methods ********} + {Function Creates a new Service and Returns the Services Handle + or 0 on Failure. (Name already exists)} + CreateService: function (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall; + + {Function Destroys a Service. + 0 on success, not 0 on Failure} + DestroyService: function (hService: THandle): integer; stdcall; + + {Function Calls a Services Proc + Returns Services Return Value or SERVICE_NOT_FOUND on Failure} + CallService: function (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall; + + {Function Returns Non Zero if a Service with the given Name Exists, + otherwise 0} + ServiceExists: function (ServiceName: PChar): integer; stdcall; + end; + + //---------------- + //TModuleInfo: Info about Modules. Result of Core/GetModuleInfo + //---------------- + PModuleInfo = ^TModuleInfo; + TModuleInfo = record + Name: string; + Version: LongWord; + Description: string; + end; + AModuleInfo = array of TModuleInfo; + + //---------------- + // Procs that should be exported by Plugin Dlls + //---------------- + //Procedure is called to check if this is USDx Plugin + //Info is Pointer to this Plugins Info. Size is already set. Don't write over this limit + Proc_PluginInfo = procedure (Info: PUS_PluginInfo); stdcall; + + //Called on Plugins Load. If Non Zero is Returned => abort Loading + //PInterface is Pointer to PluginInterface + Func_Load = function (const PInterface: PUS_PluginInterface): integer; stdcall; + + //Called on Plugins Init. If Non Zero is Returned => abort Loading + //PInterface is Pointer to PluginInterface + Func_Init = function (const PInterface: PUS_PluginInterface): integer; stdcall; + + //Called on Plugins Deinit. + //PInterface is Pointer to PluginInterface + Proc_DeInit = procedure (const PInterface: PUS_PluginInterface); stdcall; + +//---------------- +// Some Default Constants +//---------------- +const + {Returned if Service is not found from CallService} + SERVICE_NOT_FOUND = LongInt($80000000); + + //for use in Service 'Core/ShowMessage' lParam(Symbol) + CORE_SM_NOSYMBOL= 0; + CORE_SM_ERROR = 1; + CORE_SM_WARNING = 2; + CORE_SM_INFO = 3; + +//---------------- +// Some functions to Handle Version dwords +//---------------- +function MakeVersion(const HeadRevision, SubVersion, SubVersion2: byte; Letter: char): dword; +function VersionToString(const Version: dword): string; + +implementation + +//-------------- +// MakeVersion - converts 4 values to a valid version dword +//-------------- +function MakeVersion(const HeadRevision, SubVersion, SubVersion2: byte; Letter: char): dword; +begin + if(letter < 'a') or (Letter > 'z') then + letter := chr(0); + + Result := (HeadRevision shl 24) or (SubVersion shl 16) or (SubVersion2 shl 8) or Ord(Letter); +end; + +//-------------- +// VersiontoString - Returns some beauty '1.0.2a' like string +//-------------- +function VersionToString(const Version: dword): string; +begin // to-do : Write VersiontoString without SysUtils dependence + //Result := InttoStr((ver and $FF000000) shr 24); + Result := '1.0.1' +end; + +end. diff --git a/Lua/plugins/Team_Duell/TeamDuell.dpr b/Lua/plugins/Team_Duell/TeamDuell.dpr new file mode 100644 index 00000000..18116097 --- /dev/null +++ b/Lua/plugins/Team_Duell/TeamDuell.dpr @@ -0,0 +1,241 @@ +library TeamDuell ; + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses + ModiSDK in '..\SDK\ModiSDK.pas', + StrUtils in '..\SDK\StrUtils.pas', + sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', + moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas', + sysutils; + +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 := SDL_GetTicks(); + firsttime := true; + secondtime := true; + bps := 1; + MethodRec := Methods; + 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 := SDL_GetTicks(); + end; + start := false; + // show first singers for 5sec + if (CurSentence < 1) AND ((starttick + 5000) > SDL_GetTicks()) then begin start := true; end; + + // TickCount(thirdSentence) + If (CurSentence = 3) AND (secondtime) then + begin + secondtime := false; + firsttime := true; + endtick := SDL_GetTicks(); + bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond + end; + + // Time to next Change + RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); + TtoNextChange := Trunc(RTtoNextChange) +1; + + // 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. + + |