From a93c26232ea1b01259cd045cc11eb43eb40a0273 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sat, 22 May 2010 13:03:35 +0000 Subject: added duel-ratio-option (normal, 10%-90%) for challenge mode. the plugins are nice but in challenge mode the normal duel-mode is more important. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2394 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 11 +++++++++++ Game/Code/Classes/UPartyM2.pas | 20 ++++++++++++++++++++ Game/Code/Screens/UScreenPartyOptionsM2.pas | 4 ++++ 3 files changed, 35 insertions(+) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 5228d870..0cfea5ce 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -82,6 +82,7 @@ type LineBonus: integer; PartyPopup: integer; SumPlayers: integer; + DuelRatio: integer; // Controller Joypad: integer; @@ -181,6 +182,7 @@ const ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); IPartyPopup: array[0..1] of string = ('Off', 'On'); ISumPlayers: array[0..2] of string = ('Never', 'Dynamic', 'Always'); + IDuelRatio: array[0..9] of string = ('normal', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%'); IJoypad: array[0..1] of string = ('Off', 'On'); ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights'); @@ -610,6 +612,11 @@ begin for Pet := 0 to High(ISumPlayers) do if Tekst = ISumPlayers[Pet] then Ini.SumPlayers := Pet; + // DuelRatio + Tekst := IniFile.ReadString('Advanced', 'DuelRatio', IDuelRatio[0]); + for Pet := 0 to High(IDuelRatio) do + if Tekst = IDuelRatio[Pet] then Ini.DuelRatio := Pet; + // Joypad Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]); for Pet := 0 to High(IJoypad) do @@ -844,6 +851,10 @@ begin Tekst := ISumPlayers[Ini.SumPlayers]; IniFile.WriteString('Advanced', 'SumPlayers', Tekst); + //DuelRatio + Tekst := IDuelRatio[Ini.DuelRatio]; + IniFile.WriteString('Advanced', 'DuelRatio', Tekst); + // Joypad Tekst := IJoypad[Ini.Joypad]; IniFile.WriteString('Controller', 'Joypad', Tekst); diff --git a/Game/Code/Classes/UPartyM2.pas b/Game/Code/Classes/UPartyM2.pas index ccf3bf7f..8c572610 100644 --- a/Game/Code/Classes/UPartyM2.pas +++ b/Game/Code/Classes/UPartyM2.pas @@ -62,6 +62,7 @@ type Teams: TTeamInfo; Order: PlayerOrderArray; Option_Plugins: boolean; + ID_DUELL: Byte; constructor Create; procedure GenScores; @@ -86,6 +87,7 @@ uses UGraphic, ULanguage, UMain, + UIni, Math, ULog; @@ -261,6 +263,7 @@ var max_played: integer; max_flag: boolean; must_sing: integer; + DuelRatioFactor: integer; //debug rn: array of TRN; @@ -445,6 +448,23 @@ begin //Set rounds if (Length(Plugins) >= 1) then begin + //set DuelRatioFactor + DuelRatioFactor := Round((Ini.DuelRatio*Length(Plugins)-10)/(10-Ini.DuelRatio)); + + for I := 0 to Length(Plugins) - 1 do + begin + if (Plugins[I].ID = ID_DUELL) and + not Plugins[I].Medley and not Plugins[I].MedleySurprise then + begin + for K := 1 to DuelRatioFactor do + begin + len := Length(Plugins); + SetLength(Plugins, len+1); + Plugins[len] := Plugins[I]; + end; + end; + end; + for I := 0 to NumRounds - 1 do begin SetLength (Rounds, I+1); diff --git a/Game/Code/Screens/UScreenPartyOptionsM2.pas b/Game/Code/Screens/UScreenPartyOptionsM2.pas index 7a8f5f2b..17c6560e 100644 --- a/Game/Code/Screens/UScreenPartyOptionsM2.pas +++ b/Game/Code/Screens/UScreenPartyOptionsM2.pas @@ -196,6 +196,8 @@ begin else PlaylistMan.CurPlayList := Playlist2; + PartySessionM2.ID_DUELL := ID_DUELL; + //Start Party PartySessionM2.StartNewParty(NumPlayer+2, Rounds+1); @@ -386,6 +388,8 @@ begin else PlaylistMan.CurPlayList := Playlist2; + PartySessionM2.ID_DUELL := ID_DUELL; + //Start Party PartySessionM2.StartNewParty(NumPlayer+2, Rounds+1); -- cgit v1.2.3