aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/plugins/SDK/UPartyDefs.pas
blob: 09f978129bf6598d7969e15c0ae660b3fc5fc8b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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.