@@ -74,6 +74,7 @@ TInputDeviceConfig = record
7474 DEFAULT_RESOLUTION = ' 800x600' ;
7575 IMaxPlayerCount = 6 ;
7676 IPlayers: array [0 ..4 ] of UTF8String = (' 1' , ' 2' , ' 3' , ' 4' , ' 6' );
77+ IPlayersVals: array [0 ..4 ] of integer = (1 , 2 , 3 , 4 , 6 );
7778
7879type
7980
@@ -101,13 +102,13 @@ TIni = class
101102 procedure LoadWebcamSettings (IniFile: TCustomIniFile);
102103 public
103104 // Players or Teams colors
104- SingColor: array [0 ..(IMaxPlayerCount-1 )] of integer; // FIXME remove this variable in all files
105+ SingColor: array [0 ..(IMaxPlayerCount-1 )] of integer;
105106
106107 Name : array [0 ..(IMaxPlayerCount-1 )] of UTF8String;
107108 PlayerColor: array [0 ..(IMaxPlayerCount-1 )] of integer;
108109 TeamColor: array [0 ..2 ] of integer;
109110
110- PlayerAvatar: array [0 ..(IMaxPlayerCount-1 )] of string ;
111+ PlayerAvatar: array [0 ..(IMaxPlayerCount-1 )] of UTF8String ;
111112 PlayerLevel: array [0 ..(IMaxPlayerCount-1 )] of integer;
112113
113114 // Templates for Names Mod
@@ -229,19 +230,15 @@ TIni = class
229230 procedure Save ();
230231 procedure SaveNames ();
231232 procedure SaveLevel ();
232- procedure SavePlayers (
233- TotalNumber: integer;
234- Names: array of UTF8String;
235- Colors: array of integer;
236- Levels: array of integer;
237- AvatarButtonsMd5: array of string;
238- Avatars: array of integer
239- );
233+ procedure SavePlayerColors ();
234+ procedure SavePlayerAvatars ();
235+ procedure SavePlayerLevels ();
240236 procedure SaveTeamColors ();
241237 procedure SaveShowWebScore ();
242238 procedure SaveJukeboxSongMenu ();
243239 procedure SaveSoundFont (Name : string);
244240 procedure SaveWebcamSettings ();
241+ procedure SaveNumberOfPlayers ();
245242 procedure SaveSingTimebarMode ();
246243 procedure SaveJukeboxTimebarMode ();
247244 procedure SaveJukeboxRepeatSongList ();
@@ -846,10 +843,13 @@ procedure TIni.Load();
846843
847844 for I := 0 to IMaxPlayerCount-1 do
848845 begin
846+ // Name
849847 Name [I] := IniFile.ReadString(' Name' , ' P' +IntToStr(I+1 ), ' Player' +IntToStr(I+1 ));
848+ // Color Player
850849 PlayerColor[I] := IniFile.ReadInteger(' PlayerColor' , ' P' +IntToStr(I+1 ), I + 1 );
851- Self.SingColor[I] := Self.PlayerColor[I];
850+ // Avatar Player
852851 PlayerAvatar[I] := IniFile.ReadString(' PlayerAvatar' , ' P' +IntToStr(I+1 ), ' ' );
852+ // Level Player
853853 PlayerLevel[I] := IniFile.ReadInteger(' PlayerLevel' , ' P' +IntToStr(I+1 ), 0 );
854854 end ;
855855
@@ -1317,39 +1317,54 @@ procedure TIni.SaveShowWebScore;
13171317end ;
13181318
13191319
1320- procedure TIni.SavePlayers (
1321- TotalNumber: integer;
1322- Names: array of UTF8String;
1323- Colors: array of integer;
1324- Levels: array of integer;
1325- AvatarButtonsMd5: array of string;
1326- Avatars: array of integer
1327- );
1320+ procedure TIni.SavePlayerColors ;
1321+
13281322var
13291323 IniFile: TIniFile;
1330- I, J: integer;
1331- PlayerNumber: string;
1324+ I: integer;
13321325begin
13331326 if not Filename.IsReadOnly() then
13341327 begin
1335- Self.Players := TotalNumber;
13361328 IniFile := TIniFile.Create(Filename.ToNative);
1337- IniFile.WriteString(' Game' , ' Players' , IPlayers[Players]);
1329+
1330+ // Colors for Names Mod
13381331 for I := 1 to IMaxPlayerCount do
1339- begin
1340- J := I - 1 ;
1341- Self.Name [J] := Names[J];
1342- Self.PlayerAvatar[J] := AvatarButtonsMd5[Avatars[J]];
1343- Self.PlayerColor[J] := Colors[J];
1344- Self.PlayerLevel[J] := Levels[J];
1345- Self.SingColor[J] := Colors[J];
1346- PlayerNumber := ' P' + IntToStr(I);
1347- IniFile.WriteString(' Name' , PlayerNumber, Self.Name [J]);
1348- IniFile.WriteString(' PlayerAvatar' , PlayerNumber, Self.PlayerAvatar[J]);
1349- IniFile.WriteString(' PlayerColor' , PlayerNumber, IntToStr(Self.PlayerColor[J]));
1350- IniFile.WriteInteger(' PlayerLevel' , PlayerNumber, Levels[J]);
1351- end ;
1352- IniFile.Free();
1332+ IniFile.WriteString(' PlayerColor' , ' P' + IntToStr(I), IntToStr(PlayerColor[I-1 ]));
1333+
1334+ IniFile.Free;
1335+ end ;
1336+ end ;
1337+
1338+ procedure TIni.SavePlayerAvatars ;
1339+ var
1340+ IniFile: TIniFile;
1341+ I: integer;
1342+ begin
1343+ if not Filename.IsReadOnly() then
1344+ begin
1345+ IniFile := TIniFile.Create(Filename.ToNative);
1346+
1347+ // Colors for Names Mod
1348+ for I := 1 to IMaxPlayerCount do
1349+ IniFile.WriteString(' PlayerAvatar' , ' P' + IntToStr(I), PlayerAvatar[I-1 ]);
1350+
1351+ IniFile.Free;
1352+ end ;
1353+ end ;
1354+
1355+ procedure TIni.SavePlayerLevels ;
1356+ var
1357+ IniFile: TIniFile;
1358+ I: integer;
1359+ begin
1360+ if not Filename.IsReadOnly() then
1361+ begin
1362+ IniFile := TIniFile.Create(Filename.ToNative);
1363+
1364+ for I := 1 to IMaxPlayerCount do
1365+ IniFile.WriteInteger(' PlayerLevel' , ' P' + IntToStr(I), PlayerLevel[I-1 ]);
1366+
1367+ IniFile.Free;
13531368 end ;
13541369end ;
13551370
@@ -1401,6 +1416,21 @@ procedure TIni.SaveWebcamSettings;
14011416
14021417end ;
14031418
1419+ procedure TIni.SaveNumberOfPlayers ;
1420+ var
1421+ IniFile: TIniFile;
1422+ begin
1423+ if not Filename.IsReadOnly() then
1424+ begin
1425+ IniFile := TIniFile.Create(Filename.ToNative);
1426+
1427+ // Players
1428+ IniFile.WriteString(' Game' , ' Players' , IPlayers[Players]);
1429+
1430+ IniFile.Free;
1431+ end ;
1432+ end ;
1433+
14041434procedure TIni.SaveSingTimebarMode ;
14051435var
14061436 IniFile: TIniFile;
0 commit comments