aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-12 12:43:38 +0000
commit6e7b96ca3a7d47b0441bed904a9b8bb25c3223de (patch)
tree2c0fa5010e7e8c37000d7fdd52d9e919e3f0555a /Game/Code/Classes
parent08ad90ec9f574c7dc153c8d40169f3a58c9beb9a (diff)
downloadusdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.gz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.tar.xz
usdx-6e7b96ca3a7d47b0441bed904a9b8bb25c3223de.zip
* added missed dependency PNGImage.
* moved FUNCTION InitializePaths(), from uFiles to uMain as this is a more sane location for it. * updated files that used UFiles to point to UMain, and removed uFiles where its not needed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@385 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UCatCovers.pas7
-rw-r--r--Game/Code/Classes/UCommandLine.pas11
-rw-r--r--Game/Code/Classes/UCovers.pas64
-rw-r--r--Game/Code/Classes/UFiles.pas113
-rw-r--r--Game/Code/Classes/UIni.pas9
-rw-r--r--Game/Code/Classes/ULanguage.pas9
-rw-r--r--Game/Code/Classes/ULog.pas12
-rw-r--r--Game/Code/Classes/UMain.pas51
-rw-r--r--Game/Code/Classes/UPlaylist.pas9
-rw-r--r--Game/Code/Classes/USongs.pas6
10 files changed, 197 insertions, 94 deletions
diff --git a/Game/Code/Classes/UCatCovers.pas b/Game/Code/Classes/UCatCovers.pas
index 34742902..d40b2564 100644
--- a/Game/Code/Classes/UCatCovers.pas
+++ b/Game/Code/Classes/UCatCovers.pas
@@ -24,7 +24,12 @@ var
CatCovers: TCatCovers;
implementation
-uses IniFiles, SysUtils, Classes, UFiles, ULog;
+uses IniFiles,
+ SysUtils,
+ Classes,
+ // UFiles,
+ UMain,
+ ULog;
constructor TCatCovers.Create;
begin
diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas
index 03229721..259c6e16 100644
--- a/Game/Code/Classes/UCommandLine.pas
+++ b/Game/Code/Classes/UCommandLine.pas
@@ -45,7 +45,10 @@ var
Params: TCMDParams;
implementation
-uses SysUtils, UIni;
+
+uses SysUtils;
+// uINI -- Nasty requirement... ( removed with permission of blindy )
+
//-------------
// Constructor - Create class, Reset Variables and Read Infos
@@ -249,6 +252,7 @@ var
I: integer;
begin
Result := -1;
+{* JB - 12sep07 to remove uINI dependency
//Search for Language
For I := 0 to high(ILanguage) do
@@ -257,6 +261,7 @@ begin
Result := I;
Break;
end;
+*}
end;
//-------------
@@ -267,6 +272,7 @@ var
I: integer;
begin
Result := -1;
+{* JB - 12sep07 to remove uINI dependency
//Search for Resolution
For I := 0 to high(IResolution) do
@@ -275,6 +281,7 @@ begin
Result := I;
Break;
end;
+*}
end;
-end. \ No newline at end of file
+end.
diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas
index 5b0a06d4..0740c143 100644
--- a/Game/Code/Classes/UCovers.pas
+++ b/Game/Code/Classes/UCovers.pas
@@ -34,7 +34,11 @@ var
Covers: TCovers;
implementation
-uses UFiles, ULog, DateUtils;
+
+uses UMain,
+ // UFiles,
+ ULog,
+ DateUtils;
constructor TCovers.Create;
begin
@@ -56,48 +60,50 @@ var
Name: string;
// Data: array of byte;
begin
- if FileExists(GamePath + 'covers.cache') then begin
- AssignFile(F, GamePath + 'covers.cache');
- Reset(F, 1);
+ if FileExists(GamePath + 'covers.cache') then
+ begin
+ AssignFile(F, GamePath + 'covers.cache');
+ Reset(F, 1);
- WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache');
+ WritetoFile := not FileIsReadOnly(GamePath + 'covers.cache');
- SetLength(Cover, 0);
+ SetLength(Cover, 0);
- while not EOF(F) do begin
- SetLength(Cover, Length(Cover)+1);
+ while not EOF(F) do
+ begin
+ SetLength(Cover, Length(Cover)+1);
- BlockRead(F, W, 2);
- Cover[High(Cover)].W := W;
+ BlockRead(F, W, 2);
+ Cover[High(Cover)].W := W;
- BlockRead(F, H, 2);
- Cover[High(Cover)].H := H;
+ BlockRead(F, H, 2);
+ Cover[High(Cover)].H := H;
- BlockRead(F, Bits, 1);
+ BlockRead(F, Bits, 1);
- Cover[High(Cover)].Size := W * H * (Bits div 8);
+ Cover[High(Cover)].Size := W * H * (Bits div 8);
- // test
-// W := 128;
-// H := 128;
-// Bits := 24;
-// Seek(F, FilePos(F) + 3);
+ // test
+ // W := 128;
+ // H := 128;
+ // Bits := 24;
+ // Seek(F, FilePos(F) + 3);
- BlockRead(F, NLen, 2);
- SetLength(Name, NLen);
+ BlockRead(F, NLen, 2);
+ SetLength(Name, NLen);
- BlockRead(F, Name[1], NLen);
- Cover[High(Cover)].Name := Name;
+ BlockRead(F, Name[1], NLen);
+ Cover[High(Cover)].Name := Name;
- Cover[High(Cover)].Position := FilePos(F);
- Seek(F, FilePos(F) + W*H*(Bits div 8));
+ Cover[High(Cover)].Position := FilePos(F);
+ Seek(F, FilePos(F) + W*H*(Bits div 8));
-// SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8));
-// BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8));
+ // SetLength(Cover[High(Cover)].Data, W*H*(Bits div 8));
+ // BlockRead(F, Cover[High(Cover)].Data[0], W*H*(Bits div 8));
- end;
+ end; // While
- CloseFile(F);
+ CloseFile(F);
end; // fileexists
end;
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas
index e6982a1a..008061a4 100644
--- a/Game/Code/Classes/UFiles.pas
+++ b/Game/Code/Classes/UFiles.pas
@@ -2,9 +2,12 @@ unit UFiles;
interface
-uses USongs, SysUtils, ULog, UMusic;
+uses SysUtils,
+ ULog,
+ UMusic,
+ USongs;
-procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs
+//procedure InitializePaths; //Function sets All Absolute Paths eg. for Songs
function ReadTXTHeader(var Song: TSong): boolean; //Reads Standard TXT Header
function AnalyseFile(var Song: TSong): boolean; //Analyse Song File and Read Header
procedure ClearSong(var Song: TSong); //Clears Song Header values
@@ -13,12 +16,13 @@ procedure ClearSong(var Song: TSong); //Clears Song Header values
procedure ResetSingTemp;
procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string);
procedure NewSentence(NrCzesciP: integer; Param1, Param2: integer);
-function LoadSong(Name: string): boolean;
-function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean;
+function LoadSong(Name: string): boolean;
+function SaveSong(Song: TSong; Czesc: TCzesci; Name: string; Relative: boolean): boolean;
var
+{*
//Absolute Paths
GamePath: string;
SoundPath: string;
@@ -30,6 +34,7 @@ var
LanguagesPath: string;
PluginPath: string;
PlayListPath: string;
+*}
SongFile: TextFile; // all procedures in this unit operates on this file
FileLineNo: integer; //Line which is readed at Last, for error reporting
@@ -41,57 +46,51 @@ var
MultBPM: integer = 4;
implementation
-uses TextGL, UIni, UMain;
+uses TextGL,
+ UIni,
+ UMain;
+{*
//--------------------
// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
//--------------------
procedure InitializePaths;
-var
- Writeable: Boolean;
-begin
- GamePath := ExtractFilePath(ParamStr(0));
-
- SoundPath := GamePath + 'Sounds\';
- SongPath := GamePath + 'Songs\';
- LogPath := GamePath;
- ThemePath := GamePath + 'Themes\';
- ScreenshotsPath := GamePath + 'Screenshots\';
- CoversPath := GamePath + 'Covers\';
- LanguagesPath := GamePath + 'Languages\';
- PluginPath := GamePath + 'Plugins\';
- PlaylistPath := GamePath + 'Playlists\';
-
- //After Setting Paths, make sure that Paths exist
- If not DirectoryExists(SoundPath) then
- Writeable := ForceDirectories(SoundPath);
-
- If Writeable And (not DirectoryExists(SongPath)) then
- Writeable := ForceDirectories(SongPath);
-
- If Writeable And (not DirectoryExists(ThemePath)) then
- Writeable := ForceDirectories(ThemePath);
- If Writeable And (not DirectoryExists(ScreenshotsPath)) then
- Writeable := ForceDirectories(ScreenshotsPath);
-
- If Writeable And (not DirectoryExists(CoversPath)) then
- Writeable := ForceDirectories(CoversPath);
-
- If Writeable And (not DirectoryExists(LanguagesPath)) then
- Writeable := ForceDirectories(LanguagesPath);
-
- If Writeable And (not DirectoryExists(PluginPath)) then
- Writeable := ForceDirectories(PluginPath);
+ // Initialize a Path Variable
+ // After Setting Paths, make sure that Paths exist
+ function initialize_path( out aPathVar : String; const aLocation : String ): boolean;
+ var
+ lWriteable: Boolean;
+ begin
+ aPathVar := aLocation;
+
+ If DirectoryExists(aPathVar) then
+ lWriteable := ForceDirectories(aPathVar)
+ else
+ lWriteable := false;
- If Writeable And (not DirectoryExists(PlaylistPath)) then
- Writeable := ForceDirectories(PlaylistPath);
+ if not Writeable then
+ Log.LogError('Error: Dir ('+ aLocation +') is Readonly');
+
+ result := lWriteable;
+ end;
- if not Writeable then
- Log.LogError('Error: Dir is Readonly');
+begin
+ GamePath := ExtractFilePath(ParamStr(0));
+
+ initialize_path( LogPath , GamePath );
+ initialize_path( SoundPath , GamePath + 'Sounds\' );
+ initialize_path( SongPath , GamePath + 'Songs\' );
+ initialize_path( ThemePath , GamePath + 'Themes\' );
+ initialize_path( ScreenshotsPath , GamePath + 'Screenshots\');
+ initialize_path( CoversPath , GamePath + 'Covers\' );
+ initialize_path( LanguagesPath , GamePath + 'Languages\' );
+ initialize_path( PluginPath , GamePath + 'Plugins\' );
+ initialize_path( PlaylistPath , GamePath + 'Playlists\' );
DecimalSeparator := ',';
end;
+*}
//--------------------
// Clears Song Header values
@@ -99,29 +98,29 @@ end;
procedure ClearSong(var Song: TSong);
begin
//Main Information
- Song.Title := '';
+ Song.Title := '';
Song.Artist := '';
//Sortings:
- Song.Genre := 'Unknown';
- Song.Edition := 'Unknown';
+ Song.Genre := 'Unknown';
+ Song.Edition := 'Unknown';
Song.Language := 'Unknown'; //Language Patch
//Required Information
- Song.Mp3 := '';
- Song.BPM := 0;
- Song.GAP := 0;
- Song.Start := 0;
+ Song.Mp3 := '';
+ Song.BPM := 0;
+ Song.GAP := 0;
+ Song.Start := 0;
Song.Finish := 0;
//Additional Information
Song.Background := '';
- Song.Cover := '';
- Song.Video := '';
- Song.VideoGAP := 0;
- Song.NotesGAP := 0;
+ Song.Cover := '';
+ Song.Video := '';
+ Song.VideoGAP := 0;
+ Song.NotesGAP := 0;
Song.Resolution := 4;
- Song.Creator := '';
+ Song.Creator := '';
end;
//--------------------
@@ -791,4 +790,4 @@ begin
CloseFile(SongFile);
end;
-end. \ No newline at end of file
+end.
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas
index 846c0deb..67649a51 100644
--- a/Game/Code/Classes/UIni.pas
+++ b/Game/Code/Classes/UIni.pas
@@ -162,7 +162,14 @@ const
IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6');
implementation
-uses UFiles, SDL, ULanguage, USkins, URecord, UCommandLine;
+
+uses //UFiles,
+ UMain,
+ SDL,
+ ULanguage,
+ USkins,
+ URecord,
+ UCommandLine;
procedure TIni.Load;
var
diff --git a/Game/Code/Classes/ULanguage.pas b/Game/Code/Classes/ULanguage.pas
index 4649c089..5deed1f7 100644
--- a/Game/Code/Classes/ULanguage.pas
+++ b/Game/Code/Classes/ULanguage.pas
@@ -36,7 +36,14 @@ var
implementation
-uses UFiles, UIni, IniFiles, Classes, SysUtils, Windows, ULog;
+uses UMain,
+ // UFiles,
+ UIni,
+ IniFiles,
+ Classes,
+ SysUtils,
+ Windows,
+ ULog;
//----------
//Create - Construct Class then LoadList + Standard Language + Set Standard Implode Glues
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 9d20d2f1..2233ec1b 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -45,7 +45,17 @@ var
Log: TLog;
implementation
-uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows, UCommandLine;
+
+uses
+ Windows,
+ SysUtils,
+ DateUtils,
+// UFiles,
+ UMain,
+ URecord,
+ UTime,
+// UIni, // JB - Seems to not be needed.
+ UCommandLine;
destructor TLog.Free;
begin
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 98e1acb4..43010bde 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -70,6 +70,18 @@ type
var
+ //Absolute Paths
+ GamePath: string;
+ SoundPath: string;
+ SongPath: string;
+ LogPath: string;
+ ThemePath: string;
+ ScreenshotsPath: string;
+ CoversPath: string;
+ LanguagesPath: string;
+ PluginPath: string;
+ PlayListPath: string;
+
OGL: Boolean;
Done: Boolean;
Event: TSDL_event;
@@ -80,6 +92,7 @@ var
Player: array of TPlayer;
PlayersPlay: integer;
+procedure InitializePaths;
procedure MainLoop;
procedure CheckEvents;
@@ -706,9 +719,47 @@ begin
Player[PlayerNum].LineBonus_TargetX := 70 + PlayerNum*500;
Player[PlayerNum].LineBonus_TargetY := 30;
//PhrasenBonus - Line Bonus Mod End
+end;
+
+//--------------------
+// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist
+//--------------------
+procedure InitializePaths;
+
+ // Initialize a Path Variable
+ // After Setting Paths, make sure that Paths exist
+ function initialize_path( out aPathVar : String; const aLocation : String ): boolean;
+ var
+ lWriteable: Boolean;
+ begin
+ aPathVar := aLocation;
+
+ If DirectoryExists(aPathVar) then
+ lWriteable := ForceDirectories(aPathVar)
+ else
+ lWriteable := false;
+
+ if not lWriteable then
+ Log.LogError('Error: Dir ('+ aLocation +') is Readonly');
+
+ result := lWriteable;
+ end;
+
+begin
+ GamePath := ExtractFilePath(ParamStr(0));
+ initialize_path( LogPath , GamePath );
+ initialize_path( SoundPath , GamePath + 'Sounds\' );
+ initialize_path( SongPath , GamePath + 'Songs\' );
+ initialize_path( ThemePath , GamePath + 'Themes\' );
+ initialize_path( ScreenshotsPath , GamePath + 'Screenshots\');
+ initialize_path( CoversPath , GamePath + 'Covers\' );
+ initialize_path( LanguagesPath , GamePath + 'Languages\' );
+ initialize_path( PluginPath , GamePath + 'Plugins\' );
+ initialize_path( PlaylistPath , GamePath + 'Playlists\' );
+ DecimalSeparator := ',';
end;
end.
diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas
index e3f68239..1e517ef7 100644
--- a/Game/Code/Classes/UPlaylist.pas
+++ b/Game/Code/Classes/UPlaylist.pas
@@ -59,7 +59,14 @@ type
implementation
-uses USongs, ULog, UFiles, UGraphic, UThemes, SysUtils;
+
+uses USongs,
+ ULog,
+ UMain,
+ //UFiles,
+ UGraphic,
+ UThemes,
+ SysUtils;
//----------
//Create - Construct Class - Dummy for now
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas
index edf5b6df..7065024b 100644
--- a/Game/Code/Classes/USongs.pas
+++ b/Game/Code/Classes/USongs.pas
@@ -96,7 +96,11 @@ var
implementation
-uses UFiles, UIni, StrUtils;
+uses StrUtils,
+ UFiles,
+ UMain,
+ UIni;
+
procedure TSongs.LoadSongList;
begin