aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/plugins/SDK
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-08 15:00:25 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-08 15:00:25 +0000
commitf44a93685ae651a08b51a2688a1c8d4c9ae2d28e (patch)
tree55a0e746490984861807e2a2ab349a1c29b028b9 /cmake/plugins/SDK
parent3dc85900d3b6f2bdd269229683452702c3d37cae (diff)
downloadusdx-f44a93685ae651a08b51a2688a1c8d4c9ae2d28e.tar.gz
usdx-f44a93685ae651a08b51a2688a1c8d4c9ae2d28e.tar.xz
usdx-f44a93685ae651a08b51a2688a1c8d4c9ae2d28e.zip
checkin of trunk-copy as base for cmake test
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1716 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--cmake/plugins/SDK/ModiSDK.pas164
-rw-r--r--cmake/plugins/SDK/USDXStrUtils.pas79
2 files changed, 243 insertions, 0 deletions
diff --git a/cmake/plugins/SDK/ModiSDK.pas b/cmake/plugins/SDK/ModiSDK.pas
new file mode 100644
index 00000000..7fc50bb8
--- /dev/null
+++ b/cmake/plugins/SDK/ModiSDK.pas
@@ -0,0 +1,164 @@
+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 type, 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 line bonus should be enabled
+ EnLineBonus_O: boolean; // Load from ini whether line bonus should be enabled
+
+ BGShowFull: boolean; // Whether the background or the video should be shown full size
+ BGShowFull_O: boolean; // Whether the background or the video should be shown full size
+
+ // 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 sound data is available
+ Dummy: boolean; // Should be set to false... for updateing plugin interface
+
+ NumPlayers: byte // Number of available players for modus
+ // 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 give to the plugin
+ 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;
+ Print: fModi_Print;
+ LoadSound: fModi_LoadSound;
+ PlaySound: pModi_PlaySound;
+ end;
+ // DLL functions
+ // Give the plugins info
+ 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;
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ // Executed everytime the screen is drawn // if false the game finishes
+ fModi_Draw = function (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean;
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ // Is executed on finish, returns the player num of the winner
+ 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);
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+
+implementation
+
+end.
diff --git a/cmake/plugins/SDK/USDXStrUtils.pas b/cmake/plugins/SDK/USDXStrUtils.pas
new file mode 100644
index 00000000..94e5f65f
--- /dev/null
+++ b/cmake/plugins/SDK/USDXStrUtils.pas
@@ -0,0 +1,79 @@
+unit USDXStrUtils;
+
+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.