From 7bf5487faf2b099ced0b2126c2cca164be80acf1 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 May 2007 10:57:17 +0000 Subject: Some changes mode on ModiSDK and Depending Files(Plugin Loader, Party SingScreen and Plugins) Changes make the Pluginsystem more extendable with backwards compatibility in further Versions. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@220 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDLLManager.pas | 22 ++++++--- Game/Code/Screens/UScreenSingModi.pas | 2 - Modis/5000Points/Until5000.dpr | 6 ++- Modis/Blind/Blind.dpr | 11 +++-- Modis/Don't_Get_Worse/Hold_The_Line.dpr | 20 ++++----- Modis/Duell/Duell.dpr | 8 +++- Modis/SDK/ModiSDK.pas | 80 ++++++++++++++++++--------------- 7 files changed, 87 insertions(+), 62 deletions(-) diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 59c75d5b..4b8838b9 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -25,7 +25,7 @@ type function LoadPlugin(No: Cardinal): boolean; procedure UnLoadPlugin; - function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; + function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; function PluginFinish (var Playerinfo: TPlayerinfo): byte; procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); @@ -75,6 +75,9 @@ end; procedure TDLLMan.ClearPluginInfo(No: Cardinal); begin + //Set to Party Modi Plugin + Plugins[No].Typ := 8; + Plugins[No].Name := 'unknown'; Plugins[No].NumPlayers := 0; @@ -183,12 +186,19 @@ if (hLib <> 0) then @P_RData := nil; end; -function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; +function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; +var + Methods: TMethodRec; begin -if (@P_Init <> nil) then - Result := P_Init (TeamInfo, PlayerInfo, Sentences, LoadTex, Print, LoadSound, PlaySound) -else - Result := False + Methods.LoadTex := LoadTex; + Methods.Print := Print; + Methods.LoadSound := LoadSound; + Methods.PlaySound := PlaySound; + + if (@P_Init <> nil) then + Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods) + else + Result := False end; function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 93ede980..0b9ab893 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -1061,8 +1061,6 @@ begin Result.TexNum := Tex.TexNum; Result.W := Tex.W; Result.H := Tex.H; - Result.ScaleW := Tex.ScaleW; - Result.ScaleH := Tex.ScaleH; end; { function Translate (const Name: PChar): PChar; stdcall; diff --git a/Modis/5000Points/Until5000.dpr b/Modis/5000Points/Until5000.dpr index 8d66eb5f..b826d212 100644 --- a/Modis/5000Points/Until5000.dpr +++ b/Modis/5000Points/Until5000.dpr @@ -7,12 +7,14 @@ uses procedure PluginInfo (var Info: TPluginInfo); stdcall; begin Info.Name := 'PLUGIN_UNTIL5000_NAME'; - Info.NumPlayers := 31; 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: @@ -38,7 +40,7 @@ begin end; //Executed on Game Start //If True Game begins, else Failure -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall; +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; begin Result := True; end; diff --git a/Modis/Blind/Blind.dpr b/Modis/Blind/Blind.dpr index ab440e67..c806171d 100644 --- a/Modis/Blind/Blind.dpr +++ b/Modis/Blind/Blind.dpr @@ -7,11 +7,14 @@ uses procedure PluginInfo (var Info: TPluginInfo); stdcall; begin Info.Name := 'PLUGIN_BLIND_NAME'; - Info.NumPlayers := 31; 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 @@ -38,7 +41,7 @@ begin end; //Executed on Game Start //If True Game begins, else Failure -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall; +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; begin Result := True; end; @@ -86,7 +89,9 @@ begin end; end; end; - + //If everybody has 0 Points nobody Wins + If (MaxScore = 0) then + Result := 0; end; exports diff --git a/Modis/Don't_Get_Worse/Hold_The_Line.dpr b/Modis/Don't_Get_Worse/Hold_The_Line.dpr index ef7a16f7..de19858b 100644 --- a/Modis/Don't_Get_Worse/Hold_The_Line.dpr +++ b/Modis/Don't_Get_Worse/Hold_The_Line.dpr @@ -10,8 +10,7 @@ var PointerTex: TSmallTexture; CountSentences: Cardinal; Limit: Byte; - fPrint: fModi_Print; - fPlaySound: fModi_PlaySound; + MethodRec: TMethodRec; Frame: Integer; PlayerTimes: array[0..5] of Integer; LastTick: Cardinal; @@ -23,12 +22,14 @@ var procedure PluginInfo (var Info: TPluginInfo); stdcall; begin Info.Name := 'PLUGIN_HDL_NAME'; - Info.NumPlayers := 31; 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: @@ -54,28 +55,27 @@ begin end; //Executed on Game Start //If True Game begins, else Failure -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall; +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; var I: Integer; Texname, TexType: PChar; begin TexName := CreateStr(PChar('HDL_Pointer')); TexType := CreateStr(PChar('Font Black')); - PointerTex := LoadTex(TexName, TexType); + PointerTex := Methods.LoadTex(TexName, TexType); FreeStr(TexName); FreeStr(TexType); TexName := CreateStr(PChar('dismissed.mp3')); - DismissedSound := LoadSound (TexName); + DismissedSound := Methods.LoadSound (TexName); FreeStr(TexName); CountSentences := Sentences.High; Limit := 0; Frame := 0; - fPrint := Print; - fPlaySound := PlaySound; + MethodRec := Methods; for I := 0 to PlayerInfo.NumPlayers-1 do begin @@ -138,7 +138,7 @@ begin Inc(C); PlayerTimes[I] := CurSentence; //Save Time of Dismission //PlaySound - fPlaySound (DismissedSound); + MethodRec.PlaySound (DismissedSound); end; //Draw Pointer @@ -172,7 +172,7 @@ begin glColor4f (0.8, 0.8, 0.8, 1); - fPrint (1, 6, PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY-8, Text); + MethodRec.Print (1, 6, PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY-8, Text); FreeStr(Text); end; end; diff --git a/Modis/Duell/Duell.dpr b/Modis/Duell/Duell.dpr index 4a22a5d7..cff9d4ef 100644 --- a/Modis/Duell/Duell.dpr +++ b/Modis/Duell/Duell.dpr @@ -7,12 +7,13 @@ uses procedure PluginInfo (var Info: TPluginInfo); stdcall; begin Info.Name := 'PLUGIN_DUELL_NAME'; - Info.NumPlayers := 31; 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: @@ -38,7 +39,7 @@ begin end; //Executed on Game Start //If True Game begins, else Failure -function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall; +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; begin Result := True; end; @@ -85,6 +86,9 @@ begin end; end; + //When nobody has Points -> Everybody loose + if (MaxScore = 0) then + Result := 0; end; exports diff --git a/Modis/SDK/ModiSDK.pas b/Modis/SDK/ModiSDK.pas index dc3b74c0..d8bad0d2 100644 --- a/Modis/SDK/ModiSDK.pas +++ b/Modis/SDK/ModiSDK.pas @@ -9,37 +9,41 @@ type //PluginInfo, for Init Creator: Array [0..32] of Char; //Name of the Author PluginDesc: Array [0..64] of Char; //Plugin Description - //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 + //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; @@ -76,8 +80,6 @@ type //PluginInfo, for Init TexNum: integer; W: real; H: real; - ScaleW: real; // for dynamic scalling while leaving width constant - ScaleH: real; // for dynamic scalling while leaving height constant end; TSentences = record @@ -110,8 +112,6 @@ type //PluginInfo, for Init end; end; - //AChar = array [0..254] of Char; - DWORD = Longword; HSTREAM = DWORD; @@ -120,13 +120,19 @@ type //PluginInfo, for Init //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 - fModi_PlaySound = procedure (const Index: Cardinal); stdcall; //Plays 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 LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall; + 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 -- cgit v1.2.3