From b38772ffdbcc6bf2189d0e14a9828f911ea44a7d Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 21 Mar 2009 19:25:18 +0000 Subject: new branch for whiteshark's service and hook based (party) plugins git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1643 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../plugins/Don't_Get_Worse/Hold_The_Line.bdsproj | 175 +++++++++++++++++ .../plugins/Don't_Get_Worse/Hold_The_Line.dpr | 215 +++++++++++++++++++++ .../plugins/Don't_Get_Worse/Hold_The_Line.lpi | 108 +++++++++++ .../plugins/Don't_Get_Worse/dismissed.mp3 | Bin 0 -> 5433 bytes 4 files changed, 498 insertions(+) create mode 100644 ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj create mode 100644 ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.dpr create mode 100644 ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.lpi create mode 100644 ServiceBasedPlugins/plugins/Don't_Get_Worse/dismissed.mp3 (limited to 'ServiceBasedPlugins/plugins/Don't_Get_Worse') diff --git a/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj b/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj new file mode 100644 index 00000000..8694fb50 --- /dev/null +++ b/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.bdsproj @@ -0,0 +1,175 @@ + + + + + + + + + + + + Hold_The_Line.dpr + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 4194304 + + + + + + + + ..\..\src\lib\JEDI-SDL\SDL\Pas + + + + False + + + + + + False + + + True + False + + + + $00000000 + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + diff --git a/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.dpr new file mode 100644 index 00000000..8bfb292c --- /dev/null +++ b/ServiceBasedPlugins/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, 18, 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/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.lpi b/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.lpi new file mode 100644 index 00000000..bb21d5d9 --- /dev/null +++ b/ServiceBasedPlugins/plugins/Don't_Get_Worse/Hold_The_Line.lpi @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + <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/ServiceBasedPlugins/plugins/Don't_Get_Worse/dismissed.mp3 b/ServiceBasedPlugins/plugins/Don't_Get_Worse/dismissed.mp3 new file mode 100644 index 00000000..f478e7a3 Binary files /dev/null and b/ServiceBasedPlugins/plugins/Don't_Get_Worse/dismissed.mp3 differ -- cgit v1.2.3