diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/SDK/ModiSDK.pas | 31 | ||||
-rw-r--r-- | src/base/UDLLManager.pas | 23 | ||||
-rw-r--r-- | src/screens/UScreenSingModi.pas | 29 |
3 files changed, 52 insertions, 31 deletions
diff --git a/plugins/SDK/ModiSDK.pas b/plugins/SDK/ModiSDK.pas index c0e66387..fe050be2 100644 --- a/plugins/SDK/ModiSDK.pas +++ b/plugins/SDK/ModiSDK.pas @@ -125,11 +125,17 @@ type //PluginInfo, for Init ); //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 + fModi_LoadTex = function (const Name: PChar; Typ: TTextureType): TsmallTexture; //Pointer to Texture Loader + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + //fModi_Translate = function (const Name, Translation: AChar): Integer; //Pointer to Translator + // {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + + fModi_Print = procedure (const Style, Size: Byte; const X, Y: Real; const Text: PChar); //Procedure to Print Text //Now translated automatically + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + fModi_LoadSound = function (const Name: PChar): Cardinal; //Procedure that loads a Custom Sound + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} + pModi_PlaySound = procedure (const Index: Cardinal); //Plays a Custom Sound + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} TMethodRec = record LoadTex: fModi_LoadTex; @@ -139,15 +145,20 @@ type //PluginInfo, for Init end; //DLL Funktionen //Gave the Plugins Info - pModi_PluginInfo = procedure (var Info: TPluginInfo); stdcall; + pModi_PluginInfo = procedure (var Info: TPluginInfo); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Executed on Game Start //If True Game begins, else Failure - fModi_Init = function (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; + fModi_Init = function (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Executed everytime the Screen is Drawed //If False The Game finishes - fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; + fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Is Executed on Finish, Returns the Playernum of the Winner - fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; stdcall; + fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Procedure called when new Sound Data is available - pModi_RData = procedure (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); stdcall; + pModi_RData = procedure (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} implementation diff --git a/src/base/UDLLManager.pas b/src/base/UDLLManager.pas index cd4b7991..9ecee34a 100644 --- a/src/base/UDLLManager.pas +++ b/src/base/UDLLManager.pas @@ -69,8 +69,6 @@ var DLLMan: TDLLMan; const - DLLPath = 'Plugins'; - {$IF Defined(MSWINDOWS)} DLLExt = '.dll'; {$ELSEIF Defined(DARWIN)} @@ -87,6 +85,7 @@ uses {$ELSE} dynlibs, {$ENDIF} + UPath, ULog, SysUtils; @@ -104,7 +103,7 @@ var SR: TSearchRec; begin - if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then + if FindFirst(PluginPath + '*' + DLLExt, faAnyFile , SR) = 0 then begin repeat SetLength(Plugins, Length(Plugins)+1); @@ -174,18 +173,18 @@ begin exit; } //Load Libary - hLibg := LoadLibrary(PChar(DLLPath +PathDelim+ Filename)); + hLibg := LoadLibrary(PChar(PluginPath + Filename)); //If Loaded if (hLibg <> 0) then begin //Load Info Procedure - @Info := GetProcAddress (hLibg, PChar('PluginInfo')); + @Info := GetProcAddress(hLibg, PChar('PluginInfo')); //If Loaded if (@Info <> nil) then begin //Load PluginInfo - Info (Plugins[No]); + Info(Plugins[No]); Result := True; end else @@ -193,22 +192,22 @@ begin FreeLibrary (hLibg); end - else - Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); + else + Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); end; function TDLLMan.LoadPlugin(No: Cardinal): boolean; begin Result := False; //Load Libary - hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No])); + hLib := LoadLibrary(PChar(PluginPath + PluginPaths[No])); //If Loaded if (hLib <> 0) then begin //Load Info Procedure - @P_Init := GetProcAddress (hLib, PChar('Init')); - @P_Draw := GetProcAddress (hLib, PChar('Draw')); - @P_Finish := GetProcAddress (hLib, PChar('Finish')); + @P_Init := GetProcAddress (hLib, 'Init'); + @P_Draw := GetProcAddress (hLib, 'Draw'); + @P_Finish := GetProcAddress (hLib, 'Finish'); //If Loaded if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 4ead8e55..a8bd7473 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -109,11 +109,19 @@ var CustomSounds: array of TCustomSoundEntry; //Procedured for Plugin -function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; -//function Translate (const Name: PChar): PChar; stdcall; -procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text -function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound +function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//function Translate (const Name: PChar): PChar; +// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Procedure to Print Text +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Procedure that loads a Custom Sound +function LoadSound(const Name: PChar): Cardinal; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Plays a Custom Sound +procedure PlaySound(const Index: Cardinal); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Utilys function ToSentences(Const Lines: TLines): TSentences; @@ -665,7 +673,7 @@ Winner := DllMan.PluginFinish(PlayerInfo); //DLLMan.UnLoadPlugin; end; -function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; +function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; var Texname, EXT: String; Tex: TTexture; @@ -691,7 +699,8 @@ begin Result := PChar(Language.Translate(String(Name))); end; } -procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +//Procedure to Print Text +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); @@ -702,7 +711,8 @@ begin glPrint (Language.Translate(String(Text))); end; -function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +//Procedure that loads a Custom Sound +function LoadSound(const Name: PChar): Cardinal; var Stream: TAudioPlaybackStream; i: Integer; @@ -731,7 +741,8 @@ begin Result := High(CustomSounds); end; -procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound +//Plays a Custom Sound +procedure PlaySound(const Index: Cardinal); begin if (Index <= High(CustomSounds)) then AudioPlayback.PlaySound(CustomSounds[Index].Stream); |