aboutsummaryrefslogtreecommitdiffstats
path: root/Modis/Don't_Get_Worse/Hold_The_Line.dpr
blob: 87fea3db94bae1c6585718c0ff52f053b7a18bb0 (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
library Hold_The_Line;

uses
  ModiSDK in '..\SDK\ModiSDK.pas',
  StrUtils in '..\SDK\StrUtils.pas',
  OpenGL12;

var
  PointerTex: TSmallTexture;
  CountSentences: Cardinal;
  Limit: Byte;
  fPrint: fModi_Print;
  Frame: Integer;
  PlayerTimes: array[0..5] of Integer;

//Gave the Plugins Info
procedure PluginInfo (var Info: TPluginInfo); stdcall;
begin
  Info.Name    := 'PLUGIN_HDL_NAME';
  Info.NumPlayers := 31;

  Info.Creator    := 'Whiteshark';
  Info.PluginDesc := 'PLUGIN_HDL_DESC';


  //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 LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: fModi_PlaySound): boolean; stdcall;
var
  I: Integer;
  Texname, TexType: PChar;
begin {
  TexName := CreateStr(PChar('HDL_Pointer'));
  TexType := CreateStr(PChar('Plain'));
  //PointerTex := LoadTex(TexName, TexType);

  FreeStr(TexName);
  FreeStr(TexType);

  //CountSentences := Sentences.High;
  Limit := 0;
  Frame := 0;

  fPrint := Print;

  {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;
begin
  case Limit of
    0: L := 20;
    1: L := 50;
    2: L := 75;
  end;

  C:= 0;

  Inc(Frame);

  Result := 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);

  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] := Frame; //Save Tiem of Dismission
        //ToDo: PlaySound
      end;
      
      //Draw Pointer;
      //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;

    end
    else
    begin
      Inc(C);
      //Draw Dismissed
      Text := CreateStr(PChar('PARTY_DISMISSED'));
      //Str := 'Test123';
      //fPrint (1, 6, 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 Frame;
    if (PlayerInfo.Playerinfo[I].Enabled) then
    begin
      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.