aboutsummaryrefslogtreecommitdiffstats
path: root/Lua
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-02 15:29:37 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-02 15:29:37 +0000
commit94e4421ad3a7615c7ce91beff95634c98b4edd49 (patch)
tree7bcebb5913b9eb02757a6acabaf6274d3d82a51b /Lua
parentd2c6680bc0c2354b6c972402951b6118bf6843af (diff)
downloadusdx-94e4421ad3a7615c7ce91beff95634c98b4edd49.tar.gz
usdx-94e4421ad3a7615c7ce91beff95634c98b4edd49.tar.xz
usdx-94e4421ad3a7615c7ce91beff95634c98b4edd49.zip
Display.AbortScreenChange added (used in ScreenSing and ScreenPartyOptions)
some minor fixes in UParty, ULuaParty and ULuaUsdx adapting of UScreenPartyNewRound, UScreenPartyPlayer and UScreenPartyOption nearly finished git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1705 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua')
-rw-r--r--Lua/game/plugins/PluginDescription.odtbin18415 -> 18417 bytes
-rw-r--r--Lua/src/base/UParty.pas58
-rw-r--r--Lua/src/lua/ULuaParty.pas13
-rw-r--r--Lua/src/lua/ULuaUsdx.pas4
-rw-r--r--Lua/src/menu/UDisplay.pas28
-rw-r--r--Lua/src/screens/UScreenMain.pas7
-rw-r--r--Lua/src/screens/UScreenPartyNewRound.pas255
-rw-r--r--Lua/src/screens/UScreenPartyOptions.pas26
-rw-r--r--Lua/src/screens/UScreenPartyPlayer.pas98
-rw-r--r--Lua/src/screens/UScreenSing.pas20
-rw-r--r--Lua/src/screens/UScreenSong.pas58
-rw-r--r--Lua/src/screens/UScreenSongMenu.pas17
12 files changed, 294 insertions, 290 deletions
diff --git a/Lua/game/plugins/PluginDescription.odt b/Lua/game/plugins/PluginDescription.odt
index 8ed8def9..476e5113 100644
--- a/Lua/game/plugins/PluginDescription.odt
+++ b/Lua/game/plugins/PluginDescription.odt
Binary files differ
diff --git a/Lua/src/base/UParty.pas b/Lua/src/base/UParty.pas
index 2002b861..0be7cf61 100644
--- a/Lua/src/base/UParty.pas
+++ b/Lua/src/base/UParty.pas
@@ -104,8 +104,6 @@ type
bPartyStarted: Boolean;
- Modes: array of TParty_ModeInfo; //< holds info of registred party modes
-
TimesPlayed: array of Integer; //< times every mode was played in current party game (for random mode calculation)
function IsWinner(Player, Winner: integer): boolean;
@@ -119,6 +117,10 @@ type
Rounds: array of TParty_Round; //< holds info which modes are played in this party game (if started)
Teams: array of TParty_TeamInfo; //< holds info of teams playing in current round (private for easy manipulation of lua functions)
+ Modes: array of TParty_ModeInfo; //< holds info of registred party modes
+
+ property CurrentRound: Integer read CurRound;
+
constructor Create;
{ set the attributes of Info to default values }
@@ -128,6 +130,12 @@ type
(mode name does not already exist) }
function RegisterMode(Info: TParty_ModeInfo): Boolean;
+ { returns true if modes are available for
+ players and teams that are currently set
+ up. if there are no teams set up it returns
+ if there are any party modes available }
+ function ModesAvailable: Boolean;
+
{ clears all party specific data previously stored }
procedure Clear;
@@ -301,10 +309,10 @@ end;
function TPartyGame.GetRandomPlayer(Team: integer): integer;
var
I, R: integer;
- lowestTP: byte;
- NumPwithLTP: byte;
+ lowestTP: Integer;
+ NumPwithLTP: Integer;
begin
- LowestTP := high(byte);
+ LowestTP := high(Integer);
NumPwithLTP := 0;
Result := 0;
@@ -374,7 +382,7 @@ end;
procedure TPartyGame.DefaultModeInfo(var Info: TParty_ModeInfo);
begin
Info.Name := 'undefined';
- Info.Parent := -1; //< not loaded by plugin (e.g. core modes)
+ Info.Parent := -1; //< not loaded by plugin (e.g. Duell)
Info.CanNonParty := false;
Info.CanParty := false;
Info.PlayerCount := High(Integer); //< no restrictions either on player count
@@ -411,6 +419,38 @@ begin
Modes[Len] := Info;
TimesPlayed[Len] := 0;
+
+ Result := True;
+ end;
+end;
+
+{ returns true if modes are available for
+ players and teams that are currently set
+ up. if there are no teams set up it returns
+ if there are any party modes available }
+function TPartyGame.ModesAvailable: Boolean;
+ var
+ I, J: Integer;
+ CountTeams: Integer;
+begin
+ CountTeams := Length(Teams);
+ if CountTeams = 0 then
+ begin
+ Result := (Length(Modes) > 0);
+ end
+ else
+ begin
+ for I := 0 to High(Modes) do
+ if (Modes[I].TeamCount and (1 shl (CountTeams - 1)) <> 0) then
+ begin
+ Result := True;
+
+ for J := 0 to High(Teams) do
+ Result := Result and (Modes[I].PlayerCount and (1 shl (Length(Teams[J].Players) - 1)) <> 0);
+
+ if Result then
+ Exit;
+ end;
end;
end;
@@ -486,6 +526,8 @@ begin
// first round
NextRound;
+
+ Result := True;
end;
end;
@@ -503,6 +545,8 @@ begin
// increase round counter
Inc(CurRound);
+ if (CurRound < -1) then // we start first round
+ CurRound := 0;
if (CurRound > High(Rounds)) then
CurRound := -1; //< last round played
@@ -565,10 +609,10 @@ begin
// plugin should not have to do this if it
// don't want default procedure to be executed
ScreenSong.Mode := smPartyMode;
+
with Modes[Rounds[CurRound].Mode] do
if (CallLua(Parent, Functions.BeforeSongSelect)) then
begin // execute default function:
-
// display song select screen
Display.FadeTo(@ScreenSong);
end;
diff --git a/Lua/src/lua/ULuaParty.pas b/Lua/src/lua/ULuaParty.pas
index f8becdd5..c102b2ac 100644
--- a/Lua/src/lua/ULuaParty.pas
+++ b/Lua/src/lua/ULuaParty.pas
@@ -66,12 +66,11 @@ function ULuaParty_GetTeams(L: Plua_State): Integer; cdecl;
function ULuaParty_SetTeams(L: Plua_State): Integer; cdecl;
const
- ULuaParty_Lib_f: array [0..4] of lual_reg = (
+ ULuaParty_Lib_f: array [0..3] of lual_reg = (
(name:'Register'; func:ULuaParty_Register),
(name:'GameFinished'; func:ULuaParty_GameFinished),
(name:'GetTeams'; func:ULuaParty_GetTeams),
- (name:'SetTeams'; func:ULuaParty_SetTeams),
- (name:nil; func:nil)
+ (name:'SetTeams'; func:ULuaParty_SetTeams)
);
implementation
@@ -107,8 +106,6 @@ begin
// pop value, so key is on top
lua_pop(L, 1);
end;
-
-
end;
{ Party.Register - register party mode at party manager
@@ -160,9 +157,9 @@ begin
else if (Key = 'canparty') and lua_isBoolean(L, -1) then
Info.CanParty := lua_toBoolean(L, -1)
else if (Key = 'playercount') and lua_isTable(L, -1) then
- Info.playercount := lua_toBinInt(L, -1)
+ Info.PlayerCount := lua_toBinInt(L, -1)
else if (Key = 'teamcount') and lua_isTable(L, -1) then
- Info.teamcount := lua_toBinInt(L, -1)
+ Info.TeamCount := lua_toBinInt(L, -1)
else if (Key = 'beforesongselect') and lua_isString(L, -1) then
Info.Functions.BeforeSongSelect := lua_toString(L, -1)
else if (Key = 'aftersongselect') and lua_isString(L, -1) then
@@ -182,7 +179,7 @@ begin
lua_pop(L, lua_gettop(L));
if not Party.RegisterMode(Info) then
- luaL_error(L, PChar('can''t register party mode at party manager in Party.Register'));
+ luaL_error(L, PChar('can''t register party mode at party manager in Party.Register. Is Info.Name defined or is there another mode with this name?'));
end;
{ Party.GameFinished - returns true if no party game is running or all rounds
diff --git a/Lua/src/lua/ULuaUsdx.pas b/Lua/src/lua/ULuaUsdx.pas
index 4bbb64ea..dbeb496e 100644
--- a/Lua/src/lua/ULuaUsdx.pas
+++ b/Lua/src/lua/ULuaUsdx.pas
@@ -38,7 +38,7 @@ uses ULua;
{ some basic lua c functions from usdx table }
{ Usdx.Time - returns sdl_time to have time numbers comparable with
- ultrastar delux ones. no arguments }
+ ultrastar deluxe ones. no arguments }
function ULuaUsdx_Time(L: Plua_State): Integer; cdecl;
{ Usdx.Version - returns Usdx version string (the same that US_Version
@@ -60,6 +60,8 @@ const
implementation
uses SDL, ULuaCore, UHookableEvent, UConfig;
+{ Usdx.Time - returns sdl_time to have time numbers comparable with
+ ultrastar deluxe ones. no arguments }
function ULuaUsdx_Time(L: Plua_State): Integer; cdecl;
var top: Integer;
begin
diff --git a/Lua/src/menu/UDisplay.pas b/Lua/src/menu/UDisplay.pas
index 86bad12c..1730406f 100644
--- a/Lua/src/menu/UDisplay.pas
+++ b/Lua/src/menu/UDisplay.pas
@@ -81,6 +81,9 @@ type
{ fades to specific screen (playing specified sound) }
function FadeTo(Screen: PMenu; const aSound: TAudioPlaybackStream = nil): PMenu;
+ { abort fading to the current screen, may be used in OnShow, or during fade process }
+ procedure AbortScreenChange;
+
function Draw: Boolean;
end;
@@ -311,6 +314,31 @@ begin
end; // for
end;
+{ abort fading to the next screen, may be used in OnShow, or during fade process }
+procedure TDisplay.AbortScreenChange;
+ var
+ Temp: PMenu;
+begin
+ // this is some kind of "hack" it is based on the
+ // code that is used to change the screens in TDisplay.Draw
+ // we should rewrite this whole behaviour, as it is not well
+ // structured and not well extendable. Also we should offer
+ // a possibility to change screens to plugins
+ // change this code when restructuring is done
+ if (assigned(NextScreen)) then
+ begin
+ // we have to swap the screens
+ Temp := CurrentScreen;
+ CurrentScreen := NextScreen;
+ NextScreen := Temp;
+
+ // and call the OnShow procedure of the previous screen
+ // because it was already called by default fade procedure
+ NextScreen.OnShow;
+
+ end;
+end;
+
{ fades to specific screen (playing specified sound)
returns old screen }
function TDisplay.FadeTo(Screen: PMenu; const aSound: TAudioPlaybackStream = nil): PMenu;
diff --git a/Lua/src/screens/UScreenMain.pas b/Lua/src/screens/UScreenMain.pas
index 2a2d0613..c0ab494e 100644
--- a/Lua/src/screens/UScreenMain.pas
+++ b/Lua/src/screens/UScreenMain.pas
@@ -155,12 +155,7 @@ begin
begin
if (Songs.SongList.Count >= 1) then
begin
- if (Length(DLLMan.Plugins) >= 1) then
- begin
- FadeTo(@ScreenPartyOptions, SoundLib.Start);
- end
- else //show error message, No Plugins Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ FadeTo(@ScreenPartyOptions, SoundLib.Start);
end
else //show error message, No Songs Loaded
ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
diff --git a/Lua/src/screens/UScreenPartyNewRound.pas b/Lua/src/screens/UScreenPartyNewRound.pas
index 01de9df7..0f5ffd5d 100644
--- a/Lua/src/screens/UScreenPartyNewRound.pas
+++ b/Lua/src/screens/UScreenPartyNewRound.pas
@@ -40,21 +40,9 @@ type
TScreenPartyNewRound = class(TMenu)
public
//Texts:
- TextRound1: Cardinal;
- TextRound2: Cardinal;
- TextRound3: Cardinal;
- TextRound4: Cardinal;
- TextRound5: Cardinal;
- TextRound6: Cardinal;
- TextRound7: Cardinal;
-
- TextWinner1: Cardinal;
- TextWinner2: Cardinal;
- TextWinner3: Cardinal;
- TextWinner4: Cardinal;
- TextWinner5: Cardinal;
- TextWinner6: Cardinal;
- TextWinner7: Cardinal;
+ TextRound: array [0..6] of Cardinal;
+
+ TextWinner: array [0..6] of Cardinal;
TextNextRound: Cardinal;
TextNextRoundNo: Cardinal;
@@ -63,13 +51,7 @@ type
TextNextPlayer3: Cardinal;
//Statics
- StaticRound1: Cardinal;
- StaticRound2: Cardinal;
- StaticRound3: Cardinal;
- StaticRound4: Cardinal;
- StaticRound5: Cardinal;
- StaticRound6: Cardinal;
- StaticRound7: Cardinal;
+ StaticRound: array [0..6] of Cardinal;
//Scores
TextScoreTeam1: Cardinal;
@@ -88,9 +70,7 @@ type
StaticTeam3: Cardinal;
StaticNextPlayer1: Cardinal;
StaticNextPlayer2: Cardinal;
- StaticNextPlayer3: Cardinal;
-
-
+ StaticNextPlayer3: Cardinal;
constructor Create; override;
@@ -137,16 +117,7 @@ begin
SDLK_RETURN:
begin
AudioPlayback.PlaySound(SoundLib.Start);
- if DLLMan.Selected.LoadSong then
- begin
- //Select PartyMode ScreenSong
- ScreenSong.Mode := smPartyMode;
- FadeTo(@ScreenSong);
- end
- else
- begin
- FadeTo(@ScreenSingModi);
- end;
+ Party.CallBeforeSongSelect;
end;
end;
end;
@@ -156,21 +127,21 @@ constructor TScreenPartyNewRound.Create;
begin
inherited Create;
- TextRound1 := AddText (Theme.PartyNewRound.TextRound1);
- TextRound2 := AddText (Theme.PartyNewRound.TextRound2);
- TextRound3 := AddText (Theme.PartyNewRound.TextRound3);
- TextRound4 := AddText (Theme.PartyNewRound.TextRound4);
- TextRound5 := AddText (Theme.PartyNewRound.TextRound5);
- TextRound6 := AddText (Theme.PartyNewRound.TextRound6);
- TextRound7 := AddText (Theme.PartyNewRound.TextRound7);
-
- TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1);
- TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2);
- TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3);
- TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4);
- TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5);
- TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6);
- TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7);
+ TextRound[0] := AddText (Theme.PartyNewRound.TextRound1);
+ TextRound[1] := AddText (Theme.PartyNewRound.TextRound2);
+ TextRound[2] := AddText (Theme.PartyNewRound.TextRound3);
+ TextRound[3] := AddText (Theme.PartyNewRound.TextRound4);
+ TextRound[4] := AddText (Theme.PartyNewRound.TextRound5);
+ TextRound[5] := AddText (Theme.PartyNewRound.TextRound6);
+ TextRound[6] := AddText (Theme.PartyNewRound.TextRound7);
+
+ TextWinner[0] := AddText (Theme.PartyNewRound.TextWinner1);
+ TextWinner[1] := AddText (Theme.PartyNewRound.TextWinner2);
+ TextWinner[2] := AddText (Theme.PartyNewRound.TextWinner3);
+ TextWinner[3] := AddText (Theme.PartyNewRound.TextWinner4);
+ TextWinner[4] := AddText (Theme.PartyNewRound.TextWinner5);
+ TextWinner[5] := AddText (Theme.PartyNewRound.TextWinner6);
+ TextWinner[6] := AddText (Theme.PartyNewRound.TextWinner7);
TextNextRound := AddText (Theme.PartyNewRound.TextNextRound);
TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo);
@@ -178,13 +149,13 @@ begin
TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2);
TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3);
- StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1);
- StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2);
- StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3);
- StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4);
- StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5);
- StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6);
- StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7);
+ StaticRound[0] := AddStatic (Theme.PartyNewRound.StaticRound1);
+ StaticRound[1] := AddStatic (Theme.PartyNewRound.StaticRound2);
+ StaticRound[2] := AddStatic (Theme.PartyNewRound.StaticRound3);
+ StaticRound[3] := AddStatic (Theme.PartyNewRound.StaticRound4);
+ StaticRound[4] := AddStatic (Theme.PartyNewRound.StaticRound5);
+ StaticRound[5] := AddStatic (Theme.PartyNewRound.StaticRound6);
+ StaticRound[6] := AddStatic (Theme.PartyNewRound.StaticRound7);
//Scores
TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1);
@@ -215,15 +186,15 @@ var
function GetTeamPlayers(const Num: Byte): String;
var
Players: Array of String;
- //J: Byte;
- begin // to-do : Party
- if (Num-1 >= {PartySession.Teams.NumTeams}0) then
+ J: Integer;
+ begin
+ if (Num >= Length(Party.Teams)) then
exit;
- {//Create Players Array
- SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers);
- For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do
- Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);}
+ //Create Players Array
+ SetLength(Players, Length(Party.Teams[Num-1].Players));
+ For J := 0 to High(Party.Teams[Num-1].Players) do
+ Players[J] := Party.Teams[Num-1].Players[J].Name;
//Implode and Return
Result := Language.Implode(Players);
@@ -235,126 +206,26 @@ begin
//PartySession.StartRound;
//Set Visibility of Round Infos
- // to-do : Party
- I := {Length(PartySession.Rounds)}0;
- if (I >= 1) then
- begin
- Static[StaticRound1].Visible := True;
- Text[TextRound1].Visible := True;
- Text[TextWinner1].Visible := True;
-
- //Texts:
- //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name);
- //Text[TextWinner1].Text := PartySession.GetWinnerString(0);
- end
- else
- begin
- Static[StaticRound1].Visible := False;
- Text[TextRound1].Visible := False;
- Text[TextWinner1].Visible := False;
- end;
-
- if (I >= 2) then
- begin
- Static[StaticRound2].Visible := True;
- Text[TextRound2].Visible := True;
- Text[TextWinner2].Visible := True;
-
- //Texts:
- //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name);
- //Text[TextWinner2].Text := PartySession.GetWinnerString(1);
- end
- else
- begin
- Static[StaticRound2].Visible := False;
- Text[TextRound2].Visible := False;
- Text[TextWinner2].Visible := False;
- end;
-
- if (I >= 3) then
- begin
- Static[StaticRound3].Visible := True;
- Text[TextRound3].Visible := True;
- Text[TextWinner3].Visible := True;
-
- //Texts:
- //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name);
- //Text[TextWinner3].Text := PartySession.GetWinnerString(2);
- end
- else
- begin
- Static[StaticRound3].Visible := False;
- Text[TextRound3].Visible := False;
- Text[TextWinner3].Visible := False;
- end;
-
- if (I >= 4) then
- begin
- Static[StaticRound4].Visible := True;
- Text[TextRound4].Visible := True;
- Text[TextWinner4].Visible := True;
-
- //Texts:
- //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name);
- //Text[TextWinner4].Text := PartySession.GetWinnerString(3);
- end
- else
- begin
- Static[StaticRound4].Visible := False;
- Text[TextRound4].Visible := False;
- Text[TextWinner4].Visible := False;
- end;
-
- if (I >= 5) then
- begin
- Static[StaticRound5].Visible := True;
- Text[TextRound5].Visible := True;
- Text[TextWinner5].Visible := True;
-
- //Texts:
- //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name);
- //Text[TextWinner5].Text := PartySession.GetWinnerString(4);
- end
- else
+ for I := 0 to 6 do
begin
- Static[StaticRound5].Visible := False;
- Text[TextRound5].Visible := False;
- Text[TextWinner5].Visible := False;
- end;
-
- if (I >= 6) then
- begin
- Static[StaticRound6].Visible := True;
- Text[TextRound6].Visible := True;
- Text[TextWinner6].Visible := True;
-
- //Texts:
- //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name);
- //Text[TextWinner6].Text := PartySession.GetWinnerString(5);
- end
- else
- begin
- Static[StaticRound6].Visible := False;
- Text[TextRound6].Visible := False;
- Text[TextWinner6].Visible := False;
+ if (I <= High(Party.Rounds)) then
+ begin
+ Static[StaticRound[I]].Visible := True;
+ Text[TextRound[I]].Visible := True;
+ Text[TextWinner[I]].Visible := True;
+
+ // update texts:
+ Text[TextRound[I]].Text := Language.Translate('PLUGIN_' + uppercase(Party.Modes[Party.Rounds[I].Mode].Name) + '_NAME');
+ Text[TextWinner[I]].Text := Party.GetWinnerString(I);
+ end
+ else
+ begin
+ Static[StaticRound[I]].Visible := False;
+ Text[TextRound[I]].Visible := False;
+ Text[TextWinner[I]].Visible := False;
+ end;
end;
- if (I >= 7) then
- begin
- Static[StaticRound7].Visible := True;
- Text[TextRound7].Visible := True;
- Text[TextWinner7].Visible := True;
-
- //Texts:
- //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name);
- //Text[TextWinner7].Text := PartySession.GetWinnerString(6);
- end
- else
- begin
- Static[StaticRound7].Visible := False;
- Text[TextRound7].Visible := False;
- Text[TextWinner7].Visible := False;
- end;
//Display Scores
{if (PartySession.Teams.NumTeams >= 1) then
@@ -418,34 +289,34 @@ begin
Text[TextTeam3Players].Visible := False;
Static[StaticTeam3].Visible := False;
Static[StaticNextPlayer3].Visible := False;
- end;
+ end; }
//nextRound Texts
- Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc);
- Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1);
- if (PartySession.Teams.NumTeams >= 1) then
+ {Text[TextNextRound].Text := Language.Translate('PLUGIN_' + uppercase(Party.Modes[Party.Rounds[Party.CurrentRound].Mode].Name) + '_DESC');
+ Text[TextNextRoundNo].Text := InttoStr(Party.CurrentRound + 1);
+ if (Length(Party.Teams) >= 1) then
begin
- Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name;
+ Text[TextNextPlayer1].Text := Party.Teams[0].Players[Party.Teams[0].NextPlayer].Name;
Text[TextNextPlayer1].Visible := True;
end
else
Text[TextNextPlayer1].Visible := False;
-
- if (PartySession.Teams.NumTeams >= 2) then
+
+ if (Length(Party.Teams) >= 2) then
begin
- Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name;
+ Text[TextNextPlayer2].Text := Party.Teams[1].Players[Party.Teams[1].NextPlayer].Name;
Text[TextNextPlayer2].Visible := True;
end
else
Text[TextNextPlayer2].Visible := False;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name;
+ Text[TextNextPlayer3].Text := Party.Teams[2].Players[Party.Teams[2].NextPlayer].Name;
Text[TextNextPlayer3].Visible := True;
end
else
- Text[TextNextPlayer3].Visible := False; }
+ Text[TextNextPlayer3].Visible := False;
end;
procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real);
diff --git a/Lua/src/screens/UScreenPartyOptions.pas b/Lua/src/screens/UScreenPartyOptions.pas
index d6839778..5e2c1d5a 100644
--- a/Lua/src/screens/UScreenPartyOptions.pas
+++ b/Lua/src/screens/UScreenPartyOptions.pas
@@ -121,17 +121,7 @@ begin
//Don'T start when Playlist is Selected and there are no Playlists
if (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then
Exit;
- // Don't start when SinglePlayer Teams but only Multiplayer Plugins available
- OnlyMultiPlayer := true;
- for I := 0 to High(DLLMan.Plugins) do
- begin
- OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly);
- end;
- if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then
- begin
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
- Exit;
- end;
+
//Save Difficulty
Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
Ini.SaveLevel;
@@ -306,7 +296,19 @@ procedure TScreenPartyOptions.onShow;
begin
inherited;
- Randomize;
+ Party.Clear;
+
+ // check if there are loaded modes
+ if Party.ModesAvailable then
+ begin
+ // modes are loaded
+ Randomize;
+ end
+ else
+ begin // no modes found
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ Display.AbortScreenChange;
+ end;
end;
procedure TScreenPartyOptions.SetAnimationProgress(Progress: real);
diff --git a/Lua/src/screens/UScreenPartyPlayer.pas b/Lua/src/screens/UScreenPartyPlayer.pas
index d38a6435..9a5edca2 100644
--- a/Lua/src/screens/UScreenPartyPlayer.pas
+++ b/Lua/src/screens/UScreenPartyPlayer.pas
@@ -71,11 +71,14 @@ type
implementation
-uses UGraphic, UMain, UIni, UTexture, UParty;
+uses UGraphic, UMain, UIni, UTexture, UParty, UScreenPartyOptions, ULanguage;
function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean;
var
SDL_ModState: Word;
+ I, J: Integer;
+ HighPlayer: Integer;
+ Rounds: ARounds;
procedure IntNext;
begin
repeat
@@ -243,10 +246,57 @@ begin
PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text);
PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0;
end;
+ end; }
+
+ // add teams to party
+
+ for I := 0 to ScreenPartyOptions.NumTeams + 1 do
+ begin
+ Party.AddTeam(Button[I * 5].Text[0].Text);
+
+ case I of
+ 0: HighPlayer := ScreenPartyOptions.NumPlayer1;
+ 1: HighPlayer := ScreenPartyOptions.NumPlayer2;
+ 2: HighPlayer := ScreenPartyOptions.NumPlayer3;
+ end;
+
+ for J := 0 to HighPlayer do
+ Party.AddPlayer(I, Button[I * 5 + 1 + J].Text[0].Text);
+ end;
+
+ if (Party.ModesAvailable) then
+ begin //mode for current playersetup available
+ // to - do : add round select screen
+ // atm just add random rounds to the rounds array
+ SetLength(Rounds, ScreenPartyOptions.Rounds + 2);
+
+ for I := 0 to High(Rounds) do
+ Rounds[I] := Party_Round_Random;
+
+ // start party game
+ if (Party.StartGame(Rounds)) then
+ begin
+ FadeTo(@ScreenPartyNewRound, SoundLib.Start);
+ end
+ else
+ begin
+ //error starting party game
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_CAN_NOT_START_PARTY'));
+
+ Party.Clear;
+ end;
+
+ end
+ else
+ begin
+ // no mode available for current player setup
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_MODES_FOR_CURRENT_SETUP'));
+
+ Party.Clear;
end;
- AudioPlayback.PlayStart;
- FadeTo(@ScreenPartyNewRound);}
+
+
end;
// Up and Down could be done at the same time,
@@ -310,13 +360,13 @@ begin
Button[10].Text[0].Text := Ini.NameTeam[2];
// Templates for Names Mod end
- {If (PartySession.Teams.NumTeams>=1) then
+ If (ScreenPartyOptions.NumTeams + 2 >= 1) then
begin
- Button[0].Visible := True;
- Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1);
- Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2);
- Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3);
- Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4);
+ Button[0].Visible := true;
+ Button[1].Visible := (ScreenPartyOptions.NumPlayer1 + 1 >= 1);
+ Button[2].Visible := (ScreenPartyOptions.NumPlayer1 + 1 >= 2);
+ Button[3].Visible := (ScreenPartyOptions.NumPlayer1 + 1 >= 3);
+ Button[4].Visible := (ScreenPartyOptions.NumPlayer1 + 1 >= 4);
end
else
begin
@@ -327,13 +377,13 @@ begin
Button[4].Visible := False;
end;
- If (PartySession.Teams.NumTeams>=2) then
+ If (ScreenPartyOptions.NumTeams + 2 >= 2) then
begin
- Button[5].Visible := True;
- Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1);
- Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2);
- Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3);
- Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4);
+ Button[5].Visible := true;
+ Button[6].Visible := (ScreenPartyOptions.NumPlayer2 + 1 >= 1);
+ Button[7].Visible := (ScreenPartyOptions.NumPlayer2 + 1 >= 2);
+ Button[8].Visible := (ScreenPartyOptions.NumPlayer2 + 1 >= 3);
+ Button[9].Visible := (ScreenPartyOptions.NumPlayer2 + 1 >= 4);
end
else
begin
@@ -344,13 +394,13 @@ begin
Button[9].Visible := False;
end;
- If (PartySession.Teams.NumTeams>=3) then
+ If (ScreenPartyOptions.NumTeams + 2 >= 3) then
begin
- Button[10].Visible := True;
- Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1);
- Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2);
- Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3);
- Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4);
+ Button[10].Visible := true;
+ Button[11].Visible := (ScreenPartyOptions.NumPlayer3 + 1 >= 1);
+ Button[12].Visible := (ScreenPartyOptions.NumPlayer3 + 1 >= 2);
+ Button[13].Visible := (ScreenPartyOptions.NumPlayer3 + 1 >= 3);
+ Button[14].Visible := (ScreenPartyOptions.NumPlayer3 + 1 >= 4);
end
else
begin
@@ -359,7 +409,7 @@ begin
Button[12].Visible := False;
Button[13].Visible := False;
Button[14].Visible := False;
- end; }
+ end;
end;
@@ -367,8 +417,8 @@ procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real);
var
I: integer;
begin
- for I := 0 to high(Button) do
- Button[I].Texture.ScaleW := Progress;
+ {for I := 0 to high(Button) do
+ Button[I].Texture.ScaleW := Progress; }
end;
end.
diff --git a/Lua/src/screens/UScreenSing.pas b/Lua/src/screens/UScreenSing.pas
index d49ecc7c..001fa8a3 100644
--- a/Lua/src/screens/UScreenSing.pas
+++ b/Lua/src/screens/UScreenSing.pas
@@ -101,6 +101,14 @@ type
fShowVisualization: boolean;
fCurrentVideoPlaybackEngine: IVideoPlayback;
+ // some settings to be set by plugins
+ settings: record
+
+
+
+ end;
+ procedure ClearSettings;
+
constructor Create; override;
procedure onShow; override;
procedure onShowFinish; override;
@@ -126,6 +134,7 @@ uses UGraphic,
Classes,
URecord,
ULanguage,
+ UDisplay,
Math;
// Method for input parsing. If False is returned, GetNextWindow
@@ -433,8 +442,8 @@ begin
if (not success) then
begin
- // error loading song -> go back to song screen and show some error message
- FadeTo(@ScreenSong);
+ // error loading song -> go back to previous screen and show some error message
+ Display.AbortScreenChange;
// select new song in party mode
if ScreenSong.Mode = smPartyMode then
ScreenSong.SelectRandomSong();
@@ -621,6 +630,11 @@ begin
CountSkipTimeSet;
end;
+procedure TScreenSing.ClearSettings;
+begin
+
+end;
+
procedure TScreenSing.onHide;
begin
// Unload background texture
@@ -821,7 +835,7 @@ begin
//Kill all Stars and Effects
GoldenRec.KillAll;
-
+
if (Ini.SavePlayback = 1) then
begin
Log.BenchmarkStart(0);
diff --git a/Lua/src/screens/UScreenSong.pas b/Lua/src/screens/UScreenSong.pas
index 6aa8e955..41c98228 100644
--- a/Lua/src/screens/UScreenSong.pas
+++ b/Lua/src/screens/UScreenSong.pas
@@ -142,7 +142,7 @@ type
//procedures for Menu
procedure StartSong;
procedure OpenEditor;
- procedure DoJoker(Team: Byte);
+ procedure DoJoker(Team: Integer);
procedure SelectPlayers;
procedure UnloadDetailedCover;
@@ -587,7 +587,7 @@ begin
if (Ini.PartyPopup = 1) then
ScreenSongMenu.MenuShow(SM_Party_Main)
else
- ScreenSong.StartSong;
+ Party.CallAfterSongSelect;
end;
end;
end;
@@ -1733,17 +1733,15 @@ end;
procedure TScreenSong.SetJoker;
begin
// If Party Mode
- // to-do : Party
if Mode = smPartyMode then //Show Joker that are available
begin
- (*
- if (PartySession.Teams.NumTeams >= 1) then
+ if (Length(Party.Teams) >= 1) then
begin
- Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
- Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2);
- Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3);
- Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4);
- Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5);
+ Static[StaticTeam1Joker1].Visible := (Party.Teams[0].JokersLeft >= 1);
+ Static[StaticTeam1Joker2].Visible := (Party.Teams[0].JokersLeft >= 2);
+ Static[StaticTeam1Joker3].Visible := (Party.Teams[0].JokersLeft >= 3);
+ Static[StaticTeam1Joker4].Visible := (Party.Teams[0].JokersLeft >= 4);
+ Static[StaticTeam1Joker5].Visible := (Party.Teams[0].JokersLeft >= 5);
end
else
begin
@@ -1754,13 +1752,13 @@ begin
Static[StaticTeam1Joker5].Visible := False;
end;
- if (PartySession.Teams.NumTeams >= 2) then
+ if (Length(Party.Teams) >= 2) then
begin
- Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1);
- Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2);
- Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3);
- Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4);
- Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5);
+ Static[StaticTeam2Joker1].Visible := (Party.Teams[1].JokersLeft >= 1);
+ Static[StaticTeam2Joker2].Visible := (Party.Teams[1].JokersLeft >= 2);
+ Static[StaticTeam2Joker3].Visible := (Party.Teams[1].JokersLeft >= 3);
+ Static[StaticTeam2Joker4].Visible := (Party.Teams[1].JokersLeft >= 4);
+ Static[StaticTeam2Joker5].Visible := (Party.Teams[1].JokersLeft >= 5);
end
else
begin
@@ -1771,13 +1769,13 @@ begin
Static[StaticTeam2Joker5].Visible := False;
end;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1);
- Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2);
- Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3);
- Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4);
- Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5);
+ Static[StaticTeam3Joker1].Visible := (Party.Teams[2].JokersLeft >= 1);
+ Static[StaticTeam3Joker2].Visible := (Party.Teams[2].JokersLeft >= 2);
+ Static[StaticTeam3Joker3].Visible := (Party.Teams[2].JokersLeft >= 3);
+ Static[StaticTeam3Joker4].Visible := (Party.Teams[2].JokersLeft >= 4);
+ Static[StaticTeam3Joker5].Visible := (Party.Teams[2].JokersLeft >= 5);
end
else
begin
@@ -1787,7 +1785,7 @@ begin
Static[StaticTeam3Joker4].Visible := False;
Static[StaticTeam3Joker5].Visible := False;
end;
- *)
+
end
else
begin //Hide all
@@ -1845,7 +1843,7 @@ begin
//Party Mode
if (Mode = smPartyMode) then
begin
- FadeTo(@ScreenSingModi);
+ FadeTo(@ScreenSing);
end
else
begin
@@ -1876,19 +1874,19 @@ begin
end;
//Team No of Team (0-5)
-procedure TScreenSong.DoJoker (Team: Byte);
+procedure TScreenSong.DoJoker (Team: Integer);
begin
- {
+
if (Mode = smPartyMode) and
- (PartySession.Teams.NumTeams >= Team + 1) and
- (PartySession.Teams.Teaminfo[Team].Joker > 0) then
+ (High(Party.Teams) >= Team) and
+ (Party.Teams[Team].JokersLeft > 0) then
begin
//Use Joker
- Dec(PartySession.Teams.Teaminfo[Team].Joker);
+ Dec(Party.Teams[Team].JokersLeft);
SelectRandomSong;
SetJoker;
end;
- }
+
end;
//Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song
diff --git a/Lua/src/screens/UScreenSongMenu.pas b/Lua/src/screens/UScreenSongMenu.pas
index 7aa2e498..72be93db 100644
--- a/Lua/src/screens/UScreenSongMenu.pas
+++ b/Lua/src/screens/UScreenSongMenu.pas
@@ -404,15 +404,18 @@ begin
CurMenu := sMenu;
Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER');
// to-do : Party
- {Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0);
- Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0);
- Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);}
+ Button[0].Visible := (Length(Party.Teams) >= 1) AND (Party.Teams[0].JokersLeft > 0);
+ Button[1].Visible := (Length(Party.Teams) >= 2) AND (Party.Teams[1].JokersLeft > 0);
+ Button[2].Visible := (Length(Party.Teams) >= 3) AND (Party.Teams[2].JokersLeft > 0);
Button[3].Visible := True;
SelectsS[0].Visible := False;
- {Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name);
- Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name);
- Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name);}
+ if (Button[0].Visible) then
+ Button[0].Text[0].Text := String(Party.Teams[0].Name);
+ if (Button[1].Visible) then
+ Button[1].Text[0].Text := String(Party.Teams[1].Name);
+ if (Button[2].Visible) then
+ Button[2].Text[0].Text := String(Party.Teams[2].Name);
Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
//Set right Interaction
@@ -616,7 +619,7 @@ begin
0: //Button 1
begin
//Start Singing
- ScreenSong.StartSong;
+ Party.CallAfterSongSelect;
Visible := False;
end;