aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-03-01 19:32:49 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-03-01 19:32:49 +0000
commitf76443329ab6d536326080d14f5565f066ca433f (patch)
tree7e4f585c81d52accb7cf15527fc95a2f4f2793f4 /Game/Code/Classes
parent4ec8eae5229e26b8ee648f5168d9b9c7f4e154eb (diff)
downloadusdx-f76443329ab6d536326080d14f5565f066ca433f.tar.gz
usdx-f76443329ab6d536326080d14f5565f066ca433f.tar.xz
usdx-f76443329ab6d536326080d14f5565f066ca433f.zip
summerizing of highscores in top screen as an option (never, dynamic, always);
top 3 in song menu; ctrl+print for jpg screenshots; git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2164 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UDataBase.pas47
-rw-r--r--Game/Code/Classes/UIni.pas10
-rw-r--r--Game/Code/Classes/UMain.pas5
-rw-r--r--Game/Code/Classes/UThemes.pas9
4 files changed, 62 insertions, 9 deletions
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index 580f7144..8e05475d 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -47,7 +47,7 @@ type
Destructor Free;
Procedure Init(const Filename: string);
- procedure ReadScore(var Song: TSong);
+ procedure ReadScore(var Song: TSong; max, sum: integer);
procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer; TimeStamp: integer);
procedure WriteScore(var Song: TSong);
@@ -248,20 +248,48 @@ end;
//--------------------
//ReadScore - Read Scores into SongArray
+//
+//sum:
+// 0=never
+// 1=only, if more then max entries (dynamic)
+// 2=always
//--------------------
-procedure TDataBaseSystem.ReadScore(var Song: TSong);
+procedure TDataBaseSystem.ReadScore(var Song: TSong; max, sum: integer);
var
- TableData: TSqliteTable;
- Difficulty: Byte;
- I: integer;
+ TableData: TSqliteTable;
+ Difficulty: Byte;
+ I: integer;
PlayerListed: boolean;
- DateStr: string;
+ DateStr: string;
+ num: array[0..2] of integer; //num entries easy, medium, hard
begin
if not Assigned(ScoreDB) then
Exit;
try
+ //count num entries
+ if(sum=1) then
+ begin
+ num[0] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+
+ 'WHERE `Difficulty` = 0 and '+
+ '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' +
+ Song.Artist + '" AND `Title` = "' + Song.Title +
+ '" LIMIT 1);');
+
+ num[1] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+
+ 'WHERE `Difficulty` = 1 and '+
+ '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' +
+ Song.Artist + '" AND `Title` = "' + Song.Title +
+ '" LIMIT 1);');
+
+ num[2] := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+
+ 'WHERE `Difficulty` = 2 and '+
+ '`SongID` = (SELECT `ID` FROM `us_songs` WHERE `Artist` = "' +
+ Song.Artist + '" AND `Title` = "' + Song.Title +
+ '" LIMIT 1);');
+ end;
+
//Search Song in DB
TableData := ScoreDB.GetTable('SELECT `Difficulty`, `Player`, `Score`, `Date` '+
'FROM `us_scores` WHERE '+
@@ -279,7 +307,7 @@ begin
// Add one Entry to Array
Difficulty := StrToInt(TableData.FieldAsString(TableData.FieldIndex['Difficulty']));
if ((Difficulty >= 0) and (Difficulty <= 2)) and
- (Length(Song.Score[Difficulty]) < 8) then
+ (Length(Song.Score[Difficulty]) < max) then
begin
//filter player
PlayerListed:=false;
@@ -295,7 +323,10 @@ begin
end;
end;
- if not PlayerListed then
+ if (sum=0) or
+ ((sum=1) and (num[Difficulty]<=max)) or
+ ((sum=1) and (num[Difficulty]>max) and not PlayerListed) or
+ ((sum=2) and not PlayerListed) then
begin
SetLength(Song.Score[Difficulty], Length(Song.Score[Difficulty]) + 1);
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas
index 02b9c5ef..da0d0bea 100644
--- a/Game/Code/Classes/UIni.pas
+++ b/Game/Code/Classes/UIni.pas
@@ -77,6 +77,7 @@ type
OnSongClick: integer;
LineBonus: integer;
PartyPopup: integer;
+ SumPlayers: integer;
// Controller
Joypad: integer;
@@ -161,6 +162,7 @@ const
IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu');
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');
IJoypad: array[0..1] of string = ('Off', 'On');
ILPT: array[0..2] of string = ('Off', 'LCD', 'Lights');
@@ -565,6 +567,10 @@ begin
for Pet := 0 to High(IPartyPopup) do
if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet;
+ // SumPlayers
+ Tekst := IniFile.ReadString('Advanced', 'SumPlayers', 'Dynamic');
+ for Pet := 0 to High(ISumPlayers) do
+ if Tekst = ISumPlayers[Pet] then Ini.SumPlayers := Pet;
// Joypad
Tekst := IniFile.ReadString('Controller', 'Joypad', IJoypad[0]);
@@ -780,6 +786,10 @@ begin
Tekst := IPartyPopup[Ini.PartyPopup];
IniFile.WriteString('Advanced', 'PartyPopup', Tekst);
+ //Party SumPlayers
+ Tekst := ISumPlayers[Ini.SumPlayers];
+ IniFile.WriteString('Advanced', 'SumPlayers', Tekst);
+
// Joypad
Tekst := IJoypad[Ini.Joypad];
IniFile.WriteString('Controller', 'Joypad', Tekst);
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 795f2241..cb70cd08 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -188,7 +188,10 @@ Begin
if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then
begin
// ScreenPopupError.ShowPopup('How dare you press the <Print> key'); //show error message
- Display.ScreenShot;
+ if (SDL_GetModState and KMOD_LCTRL = KMOD_LCTRL) then
+ Display.PrintScreen //jpeg
+ else
+ Display.ScreenShot; //bmp
end
// popup hack... if there is a visible popup then let it handle input instead of underlying screen
// shoud be done in a way to be sure the topmost popup has preference (maybe error, then check)
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas
index 0b1eb484..05c6575a 100644
--- a/Game/Code/Classes/UThemes.pas
+++ b/Game/Code/Classes/UThemes.pas
@@ -255,6 +255,8 @@ type
TextP2: TThemeText;
TextMedley: array[1..4] of TThemeText;
+ TextTop: array[0..2] of TThemeText;
+ StaticTop: TThemeStatic;
//Video Icon Mod
VideoIcon: TThemeStatic;
@@ -510,6 +512,7 @@ type
SelectAskbeforeDel: TThemeSelect;
SelectOnSongClick: TThemeSelectSlide;
SelectPartyPopup: TThemeSelect;
+ SelectSumPlayers: TThemeSelect;
ButtonExit: TThemeButton;
end;
@@ -1086,6 +1089,11 @@ begin
for I := 1 to 4 do
ThemeLoadText(Song.TextMedley[I], 'SongTextMedley' + IntToStr(I));
+ for I := 0 to 2 do
+ ThemeLoadText(Song.TextTop[I], 'SongTextTop' + IntToStr(I+1));
+
+ ThemeLoadStatic(Song.StaticTop, 'SongStaticTop');
+
//Video Icon Mod
ThemeLoadStatic(Song.VideoIcon, 'SongVideoIcon');
@@ -1400,6 +1408,7 @@ begin
ThemeLoadSelectSlide (OptionsAdvanced.SelectOnSongClick, 'OptionsAdvancedSelectSlideOnSongClick');
ThemeLoadSelect (OptionsAdvanced.SelectAskbeforeDel, 'OptionsAdvancedSelectAskbeforeDel');
ThemeLoadSelect (OptionsAdvanced.SelectPartyPopup, 'OptionsAdvancedSelectPartyPopup');
+ ThemeLoadSelect (OptionsAdvanced.SelectSumPlayers, 'OptionsAdvancedSelectSumPlayers');
ThemeLoadButton (OptionsAdvanced.ButtonExit, 'OptionsAdvancedButtonExit');
//error and check popup