From 13bf0be662f660d9f283b6c01b20dc2137dc835e Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 31 Mar 2008 14:34:31 +0000 Subject: - removed "Font Black" and "Font" texture type - use TEXTURE_TYPE_TRANSPARENT/COLORIZED/PLAIN in the future - texture-type is an enum now (not a string as before) -> pros: less memory consumption, compiler-check, case-insensitive, ... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@988 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 10 +- Game/Code/Classes/UGraphic.pas | 56 +++---- Game/Code/Classes/ULog.pas | 4 +- Game/Code/Classes/ULyrics.pas | 8 +- Game/Code/Classes/ULyrics_bak.pas | 4 +- Game/Code/Classes/UTexture.pas | 266 +++++++++++++++----------------- Game/Code/Classes/UThemes.pas | 30 ++-- Game/Code/Menu/UDisplay.pas | 2 + Game/Code/Menu/UMenu.pas | 263 +++++++++++++++---------------- Game/Code/Screens/UScreenCredits.pas | 52 +++---- Game/Code/Screens/UScreenEditHeader.pas | 26 ++-- Game/Code/Screens/UScreenEditSub.pas | 8 +- Game/Code/Screens/UScreenOpen.pas | 6 +- Game/Code/Screens/UScreenPartyScore.pas | 6 +- Game/Code/Screens/UScreenSingModi.pas | 6 +- Game/Code/Screens/UScreenSong.pas | 24 +-- Game/Code/Screens/UScreenWelcome.pas | 14 +- Game/Graphics/names_blindguard.png | Bin 9007 -> 23478 bytes Game/Graphics/names_blindy.png | Bin 8208 -> 21958 bytes Game/Graphics/names_canni.png | Bin 6491 -> 17494 bytes Game/Graphics/names_commandio.png | Bin 7240 -> 20290 bytes Game/Graphics/names_lazyjoker.png | Bin 8397 -> 22641 bytes Game/Graphics/names_mog.png | Bin 6247 -> 17452 bytes Game/Graphics/names_mota.png | Bin 8197 -> 22027 bytes Game/Graphics/names_skillmaster.png | Bin 7730 -> 21424 bytes Game/Graphics/names_whiteshark.png | Bin 10786 -> 27531 bytes Modis/Don't_Get_Worse/Hold_The_Line.dpr | 8 +- Modis/SDK/ModiSDK.pas | 8 +- 28 files changed, 393 insertions(+), 408 deletions(-) diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 3074fa32..d791e0cd 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -134,7 +134,7 @@ begin //Log.LogStatus( 'Font' , '---------------------------'); SetLength(Fonts, 5); - Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', 'Transparent', 0); + Fonts[0].Tex := Texture.LoadTexture(true, 'Font', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); Fonts[0].Tex.H := 30; Fonts[0].AspectW := 0.9; Fonts[0].Done := -1; @@ -142,27 +142,27 @@ begin //Log.LogStatus( 'FontB' , '---------------------------'); - Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', 'Transparent', 0); + Fonts[1].Tex := Texture.LoadTexture(true, 'FontB', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); Fonts[1].Tex.H := 30; Fonts[1].AspectW := 1; Fonts[1].Done := -1; Fonts[1].Outline := 0; //Log.LogStatus( 'FontO' , '---------------------------'); - Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', 'Transparent', 0); + Fonts[2].Tex := Texture.LoadTexture(true, 'FontO', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); Fonts[2].Tex.H := 30; Fonts[2].AspectW := 0.95; Fonts[2].Done := -1; Fonts[2].Outline := 5; //Log.LogStatus( 'FontO2' , '---------------------------'); - Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', 'Transparent', 0); + Fonts[3].Tex := Texture.LoadTexture(true, 'FontO2', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); Fonts[3].Tex.H := 30; Fonts[3].AspectW := 0.95; Fonts[3].Done := -1; Fonts[3].Outline := 4; -{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'PNG', 'Transparent', 0); // for score screen +{ Fonts[4].Tex := Texture.LoadTexture('FontO', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); // for score screen Fonts[4].Tex.H := 30; Fonts[4].AspectW := 0.95; Fonts[4].Done := -1; diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 80eedc33..d63ab31f 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -278,9 +278,9 @@ begin // zaladowanie tekstur Log.LogStatus('Loading Textures', 'LoadTextures'); - Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', 'Transparent', 0); //brauch man die noch? - Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', 'Plain', 0); //brauch man die noch? - Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', 'Transparent', 0); //brauch man die noch? + Tex_Left[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'BMP', TEXTURE_TYPE_TRANSPARENT, 0); //brauch man die noch? + Tex_Mid[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'BMP', TEXTURE_TYPE_PLAIN, 0); //brauch man die noch? + Tex_Right[0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'BMP', TEXTURE_TYPE_TRANSPARENT, 0); //brauch man die noch? Log.LogStatus('Loading Textures - A', 'LoadTextures'); @@ -292,25 +292,25 @@ begin LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', 'Colorized', Col); - Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', 'Colorized', Col); - Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', 'Colorized', Col); + Tex_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayLeft')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayMid')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('GrayRight')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); - Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', 'Colorized', Col); - Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', 'Colorized', Col); - Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', 'Colorized', Col); + Tex_plain_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainLeft')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_plain_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainMid')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_plain_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePlainRight')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); - Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', 'Colorized', Col); - Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', 'Colorized', Col); - Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', 'Colorized', Col); + Tex_BG_Left[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGLeft')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_BG_Mid[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGMid')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_BG_Right[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteBGRight')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); end; Log.LogStatus('Loading Textures - B', 'LoadTextures'); - Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'PNG', 'Transparent', 0); - Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'PNG', 'Transparent', $FFFFFF); - Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', 'Transparent', $FF00FF); - Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + Tex_Note_Perfect_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NotePerfectStar')), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + Tex_Note_Star := Texture.LoadTexture(pchar(Skin.GetTextureFileName('NoteStar')) , 'PNG', TEXTURE_TYPE_TRANSPARENT, $FFFFFF); + Tex_Ball := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + Tex_Lyric_Help_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); //TimeBar mod @@ -318,9 +318,9 @@ begin //eoa TimeBar mod //SingBar Mod - Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', 'Plain', 0); - Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', 'Plain', 0); - Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', 'Font', 0); + Tex_SingBar_Back := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBack')), 'JPG', TEXTURE_TYPE_PLAIN, 0); + Tex_SingBar_Bar := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarBar')), 'JPG', TEXTURE_TYPE_PLAIN, 0); + Tex_SingBar_Front := Texture.LoadTexture(pchar(Skin.GetTextureFileName('SingBarFront')), 'JPG', TEXTURE_TYPE_PLAIN, 0); //end Singbar Mod Log.LogStatus('Loading Textures - C', 'LoadTextures'); @@ -357,14 +357,14 @@ begin End; Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', 'Colorized', Col); + Tex_SingLineBonusBack[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LineBonusBack')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); end; //## backgrounds for the scores ## for P := 0 to 5 do begin LoadColor(R, G, B, 'P' + IntToStr(P+1) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', 'Colorized', Col); + Tex_ScoreBG[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreBG')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); end; @@ -379,23 +379,23 @@ begin //NoteBar ScoreBar LoadColor(R, G, B, 'P' + IntToStr(P) + 'Dark'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark_Round')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarLevel_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_Score_NoteBarRound_Dark[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Dark_Round')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); //LineBonus ScoreBar LoadColor(R, G, B, 'P' + IntToStr(P) + 'Light'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light_Round')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarLevel_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_Score_NoteBarRound_Light[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Light_Round')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); //GoldenNotes ScoreBar LoadColor(R, G, B, 'P' + IntToStr(P) + 'Lightest'); Col := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); - Tex_Score_NoteBarLevel_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest')), 'PNG', 'Colorized', Col); - Tex_Score_NoteBarRound_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest_Round')), 'PNG', 'Colorized', Col); + Tex_Score_NoteBarLevel_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); + Tex_Score_NoteBarRound_Lightest[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('ScoreLevel_Lightest_Round')), 'PNG', TEXTURE_TYPE_COLORIZED, Col); end; //## rating pictures that show a picture according to your rate ## for P := 0 to 6 do begin - Tex_Score_Ratings[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Rating_'+IntToStr(P))), 'PNG', 'Transparent', 0); + Tex_Score_Ratings[P] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Rating_'+IntToStr(P))), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); end; Log.LogStatus('Loading Textures - Done', 'LoadTextures'); diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 4e976ab4..2a628792 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -142,13 +142,13 @@ begin end; procedure debugWriteln( aString : String ); -begin +begin {$IFDEF CONSOLE} if FindCmdLineSwitch( cDebug ) then writeln( 'DEBUG - '+aString ); {$ENDIF} -end; +end; constructor TLog.Create; diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 6cec37b9..01ec129d 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -266,16 +266,16 @@ var begin // lyric indicator (bar that indicates when the line start) - IndicatorTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', 'Transparent', $FF00FF); + IndicatorTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricHelpBar')), 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); // ball for current word hover in ball effect - BallTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'PNG', 'Transparent', 0); + BallTex := Texture.LoadTexture(pchar(Skin.GetTextureFileName('Ball')), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); // duet mode: load player icon For I := 0 to 5 do begin - PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); end; // create line textures diff --git a/Game/Code/Classes/ULyrics_bak.pas b/Game/Code/Classes/ULyrics_bak.pas index 47c3ed03..7db7e0d9 100644 --- a/Game/Code/Classes/ULyrics_bak.pas +++ b/Game/Code/Classes/ULyrics_bak.pas @@ -119,8 +119,8 @@ begin //Only 2 Players for now For I := 0 to 1 do begin - PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); - PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', 'Transparent', 0); + PlayerIconTex[I][0] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIcon_P' + InttoStr(I+1))), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + PlayerIconTex[I][1] := Texture.LoadTexture(pchar(Skin.GetTextureFileName('LyricIconD_P' + InttoStr(I+1))), 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); end; PlayersActive := Trunc(Power(2, 1)) + 1; end; diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f96745be..48628176 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -19,7 +19,6 @@ uses OpenGL12, SysUtils, Graphics, UCommon, - UThemes, SDL, sdlutils, SDL_Image; @@ -49,13 +48,30 @@ type Name: string; // 0.5.0: experimental for handling cache images. maybe it's useful for dynamic skins end; +type + TTextureType = ( + TEXTURE_TYPE_PLAIN, // Plain (alpha = 1) + TEXTURE_TYPE_TRANSPARENT, // Alpha is used + TEXTURE_TYPE_COLORIZED // Alpha is used; Hue of the HSV color-model will be replaced by a new value + ); +const + TextureTypeStr: array[TTextureType] of string = ( + 'Plain', + 'Transparent', + 'Colorized' + ); + +function TextureTypeToStr(TexType: TTextureType): string; +function ParseTextureType(const TypeStr: string; Default: TTextureType): TTextureType; + +type TTextureEntry = record Name: string; - Typ: string; + Typ: TTextureType; // we use normal TTexture, it's easier to implement and if needed - we copy ready data Texture: TTexture; - TextureCache: TTexture; // 0.5.0 + TextureCache: TTexture; end; TTextureDatabase = record @@ -63,11 +79,10 @@ type end; TTextureUnit = class - private - function LoadImage(Identifier: PChar): PSDL_Surface; + function LoadImage(const Identifier: string): PSDL_Surface; function pixfmt_eq(fmt1,fmt2: PSDL_Pixelformat): boolean; - procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); + procedure AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: TTextureType); function GetScaledTexture(TexSurface: PSDL_Surface; W,H: Cardinal): PSDL_Surface; procedure ScaleTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal); @@ -78,41 +93,23 @@ type CreateCacheMipmap: boolean; // function GetNumberFor - function GetTexture(Name, Typ: string): TTexture; overload; - function GetTexture(Name, Typ: string; FromCache: boolean): TTexture; overload; - function FindTexture(Name: string): integer; - function LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; overload; - function LoadTexture(Identifier: string): TTexture; overload; - function CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; - procedure UnloadTexture(Name: string; FromCache: boolean); + function GetTexture(const Name: string; Typ: TTextureType): TTexture; overload; + function GetTexture(const Name: string; Typ: TTextureType; FromCache: boolean): TTexture; overload; + function FindTexture(const Name: string): integer; + function LoadTexture(FromRegistry: boolean; const Identifier, Format: string; Typ: TTextureType; Col: LongWord): TTexture; overload; + function LoadTexture(const Identifier, Format: string; Typ: TTextureType; Col: LongWord): TTexture; overload; + function LoadTexture(const Identifier: string): TTexture; overload; + function CreateTexture(var Data: array of byte; const Name: string; W, H: word; Bits: byte): TTexture; + procedure UnloadTexture(const Name: string; FromCache: boolean); Constructor Create; Destructor Destroy; override; end; -const - TEXTURE_TYPE_PLAIN = 'Plain'; // Plain (alpha = 1) - TEXTURE_TYPE_TRANSPARENT = 'Transparent'; - TEXTURE_TYPE_COLORIZED = 'Colorized'; - // obsolete: - // Font Black (black is drawn, white is transparent) - var Texture: TTextureUnit; TextureDatabase: TTextureDatabase; - // this should be in UDisplay?! - PrintScreenData: array[0..1024*768-1] of longword; - - ActTex: GLuint;//integer; - -// TextureD8: array[1..1024*1024] of byte; // 1MB - TextureD16: array[1..1024*1024, 1..2] of byte; // luminance/alpha tex (2MB) -// TextureD24: array[1..1024*1024, 1..3] of byte; // normal 24-bit tex (3MB) -// TextureD242: array[1..512*512, 1..3] of byte; // normal 24-bit tex (0,75MB) -// TextureD32: array[1..1024*1024, 1..4] of byte; // transparent 32-bit tex (4MB) - // total 40MB at 2048*2048 - // total 10MB at 1024*1024 + ActTex: GLuint; Mipmapping: Boolean; @@ -125,6 +122,7 @@ implementation uses ULog, DateUtils, UCovers, + UThemes, {$ifdef LINUX} fileutil, {$endif} @@ -138,40 +136,44 @@ uses ULog, dialogs; const - fmt_rgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - ColorKey: 0; - Alpha: 255); - fmt_rgb: TSDL_Pixelformat=( palette: nil; - BitsPerPixel: 24; - BytesPerPixel: 3; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 0; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $00000000; - ColorKey: 0; - Alpha: 255); + fmt_rgba: TSDL_Pixelformat = ( + palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + ColorKey: 0; + Alpha: 255 + ); + fmt_rgb: TSDL_Pixelformat = ( + palette: nil; + BitsPerPixel: 24; + BytesPerPixel: 3; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 0; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $00000000; + ColorKey: 0; + Alpha: 255 + ); Constructor TTextureUnit.Create; @@ -242,7 +244,7 @@ end; end; // ----------------------------------------------- -function TTextureUnit.LoadImage(Identifier: PChar): PSDL_Surface; +function TTextureUnit.LoadImage(const Identifier: string): PSDL_Surface; function FileExistsInsensative( var aFileName : PChar ): boolean; begin @@ -280,7 +282,7 @@ begin if Identifier = '' then exit; - lFileName := Identifier; + lFileName := PChar(Identifier); // Log.LogStatus( Identifier, 'LoadImage' ); @@ -336,7 +338,7 @@ begin Log.LogStatus( 'NOT found in Resource ('+Identifier+')', ' LoadImage' ); end; {$ELSE} - dHandle := FindResource(hInstance, Identifier, 'TEX'); + dHandle := FindResource(hInstance, PChar(Identifier), 'TEX'); if dHandle=0 then begin Log.LogStatus( 'ERROR Could not find resource' , ' '+ Identifier); @@ -382,16 +384,16 @@ begin end; end; -procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: PChar); +procedure TTextureUnit.AdjustPixelFormat(var TexSurface: PSDL_Surface; Typ: TTextureType); var TempSurface: PSDL_Surface; NeededPixFmt: PSDL_Pixelformat; begin NeededPixFmt:=@fmt_rgba; - if Typ= 'Plain' then NeededPixFmt:=@fmt_rgb + if (Typ = TEXTURE_TYPE_PLAIN) then NeededPixFmt:=@fmt_rgb else - if (Typ='Transparent') or - (Typ='Colorized') + if (Typ = TEXTURE_TYPE_TRANSPARENT) or + (Typ = TEXTURE_TYPE_COLORIZED) then NeededPixFmt:=@fmt_rgba else NeededPixFmt:=@fmt_rgb; @@ -527,13 +529,12 @@ begin end; end; -function TTextureUnit.LoadTexture(FromRegistry: boolean; Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +function TTextureUnit.LoadTexture(FromRegistry: boolean; const Identifier, Format: string; Typ: TTextureType; Col: LongWord): TTexture; var TexSurface: PSDL_Surface; MipmapSurface: PSDL_Surface; newWidth, newHeight: Cardinal; oldWidth, oldHeight: Cardinal; - kopierindex: Cardinal; begin Log.BenchmarkStart(4); Mipmapping := true; @@ -557,7 +558,7 @@ begin {$endif} if not assigned(TexSurface) then begin - Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ Typ ); + Log.LogStatus( 'ERROR Could not load texture' , Identifier +' '+ Format +' '+ TextureTypeToStr(Typ) ); beep; Exit; end; @@ -579,7 +580,7 @@ begin if (newHeight > Limit) then newHeight := Limit; - + if (TexSurface.W > newWidth) or (TexSurface.H > newHeight) then begin {$ifdef blindydebug} @@ -611,7 +612,7 @@ begin {$ifdef blindydebug} Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)'); {$endif} - MipmapSurface:=GetScaledTexture(TexSurface,Covers.W, Covers.H); + MipmapSurface:=GetScaledTexture(TexSurface, Covers.W, Covers.H); if assigned(MipmapSurface) then begin {$ifdef blindydebug} @@ -620,7 +621,7 @@ begin {$endif} // creating and freeing the surface could be done once, if Cover.W and Cover.H don't change CacheMipmapSurface:=SDL_CreateRGBSurfaceFrom(@CacheMipmap[0], Covers.W, Covers.H, 24, Covers.W*3, $000000ff, $0000ff00, $00ff0000, 0); - SDL_BlitSurface(MipMapSurface,nil,CacheMipmapSurface,nil); + SDL_BlitSurface(MipMapSurface, nil, CacheMipmapSurface, nil); SDL_FreeSurface(CacheMipmapSurface); {$ifdef blindydebug} Log.LogStatus('',' ok'); @@ -638,7 +639,7 @@ begin end; // should i create a cache texture, if Covers.W/H are larger? end; - + {$ifdef blindydebug} Log.LogStatus('',' JB-2'); {$endif} @@ -646,16 +647,16 @@ begin // now we might colorize the whole thing if (Typ = TEXTURE_TYPE_COLORIZED) then - ColorizeTexture(TexSurface,Col); - + ColorizeTexture(TexSurface, Col); + // save actual dimensions of our texture - oldWidth:=newWidth; - oldHeight:=newHeight; + oldWidth := newWidth; + oldHeight := newHeight; // make texture dimensions be powers of 2 - newWidth:=Round(Power(2, Ceil(Log2(newWidth)))); - newHeight:=Round(Power(2, Ceil(Log2(newHeight)))); + newWidth := Round(Power(2, Ceil(Log2(newWidth)))); + newHeight := Round(Power(2, Ceil(Log2(newHeight)))); if (newHeight <> oldHeight) or (newWidth <> oldWidth) then - FitTexture(TexSurface,newWidth,newHeight); + FitTexture(TexSurface, newWidth, newHeight); // at this point we have the image in memory... // scaled to be at most 1024x1024 pixels large @@ -672,13 +673,13 @@ begin // and could now create our openGL texture from it // prepare OpenGL texture - + // JB_linux : this is causing AV's on linux... ActText seems to be nil ! // {$IFnDEF win32} // if pointer(ActTex) = nil then // exit; // {$endif} - + glGenTextures(1, @ActTex); glBindTexture(GL_TEXTURE_2D, ActTex); @@ -692,42 +693,10 @@ begin begin glTexImage2D(GL_TEXTURE_2D, 0, 4, newWidth, newHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, TexSurface.pixels); end - else {if Typ = 'Plain' then} + else //if Typ = TEXTURE_TYPE_PLAIN then begin glTexImage2D(GL_TEXTURE_2D, 0, 3, newWidth, newHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, TexSurface.pixels); end; - - {$ifdef blindydebug} - Log.LogStatus('',' JB-4'); - {$endif} - - { - if Typ = 'Font Black' then - // and so on - begin - // normalnie 0,125s bez niczego 0,015s - 0,030s z pix 0,125s <-- ??? - // dimensions - TextureB.PixelFormat := pf24bit; - TexOrigW := TextureB.Width; - TexOrigH := TextureB.Height; - TexNewW := Round(Power(2, Ceil(Log2(TexOrigW)))); - TexNewH := Round(Power(2, Ceil(Log2(TexOrigH)))); - TextureB.Width := TexNewW; - TextureB.Height := TexNewH; - // copy and process pixeldata - for Position := 0 to TextureB.Height-1 do begin - PPix := TextureB.ScanLine[Position]; - for Position2 := 0 to TextureB.Width-1 do begin - Pix := PPix[Position2*3]; - TextureD32[Position*TextureB.Width + Position2 + 1, 1] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 2] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 3] := 255; - TextureD32[Position*TextureB.Width + Position2 + 1, 4] := 255 - (Pix mod 256); - end; - end; - glTexImage2D(GL_TEXTURE_2D, 0, 4, TextureB.Width, TextureB.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, @TextureD32); - end; - } {$ifdef blindydebug} Log.LogStatus('',' JB-5'); @@ -752,18 +721,16 @@ begin Result.ColB := 1; Result.Alpha := 1; - // 0.4.2 new test - default use whole texure, taking TexW and TexH as const and changing these + // new test - default use whole texure, taking TexW and TexH as const and changing these Result.TexX1 := 0; Result.TexY1 := 0; Result.TexX2 := 1; Result.TexY2 := 1; - + {$ifdef blindydebug} Log.LogStatus('',' JB-6'); {$endif} - - // 0.5.0 Result.Name := Identifier; SDL_FreeSurface(TexSurface); @@ -775,7 +742,7 @@ begin Log.BenchmarkEnd(4); if Log.BenchmarkTimeLength[4] >= 1 then - Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); + Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + TextureTypeToStr(Typ), 4); {$ifdef blindydebug} Log.LogStatus('',' JB-8'); @@ -784,12 +751,12 @@ begin end; -function TTextureUnit.GetTexture(Name, Typ: string): TTexture; +function TTextureUnit.GetTexture(const Name: string; Typ: TTextureType): TTexture; begin Result := GetTexture(Name, Typ, true); end; -function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTexture; +function TTextureUnit.GetTexture(const Name: string; Typ: TTextureType; FromCache: boolean): TTexture; var T: integer; // texture C: integer; // cover @@ -826,7 +793,7 @@ begin {$ifdef blindydebug} Log.LogStatus('...', 'GetTexture('''+Name+''','''+Typ+''')'); {$endif} - TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', pchar(Typ), $0); + TextureDatabase.Texture[T].Texture := LoadTexture(false, pchar(Name), 'JPG', Typ, $0); {$ifdef blindydebug} Log.LogStatus('done',' '); {$endif} @@ -853,27 +820,27 @@ begin end; end; -function TTextureUnit.FindTexture(Name: string): integer; +function TTextureUnit.FindTexture(const Name: string): integer; var T: integer; // texture begin Result := -1; for T := 0 to high(TextureDatabase.Texture) do - if TextureDatabase.Texture[T].Name = Name then + if (TextureDatabase.Texture[T].Name = Name) then Result := T; end; -function TTextureUnit.LoadTexture(Identifier, Format, Typ: PChar; Col: LongWord): TTexture; +function TTextureUnit.LoadTexture(const Identifier, Format: string; Typ: TTextureType; Col: LongWord): TTexture; begin Result := LoadTexture(false, Identifier, Format, Typ, Col); end; -function TTextureUnit.LoadTexture(Identifier: string): TTexture; +function TTextureUnit.LoadTexture(const Identifier: string): TTexture; begin - Result := LoadTexture(false, pchar(Identifier), 'JPG', 'Plain', 0); + Result := LoadTexture(false, pchar(Identifier), 'JPG', TEXTURE_TYPE_PLAIN, 0); end; -function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; +function TTextureUnit.CreateTexture(var Data: array of byte; const Name: string; W, H: word; Bits: byte): TTexture; var Position: integer; Position2: integer; @@ -924,7 +891,7 @@ begin Result.Name := Name; end; -procedure TTextureUnit.UnloadTexture(Name: string; FromCache: boolean); +procedure TTextureUnit.UnloadTexture(const Name: string; FromCache: boolean); var T: integer; TexNum: integer; @@ -948,6 +915,29 @@ begin end; end; +function TextureTypeToStr(TexType: TTextureType): string; +begin + Result := TextureTypeStr[TexType]; +end; + +function ParseTextureType(const TypeStr: string; Default: TTextureType): TTextureType; +var + TexType: TTextureType; + UpCaseStr: string; +begin + UpCaseStr := UpperCase(TypeStr); + for TexType := Low(TextureTypeStr) to High(TextureTypeStr) do + begin + if (UpCaseStr = UpperCase(TextureTypeStr[TexType])) then + begin + Result := TexType; + Exit; + end; + end; + Log.LogError('Unknown texture-type: ' + TypeStr, 'ParseTextureType'); + Result := TEXTURE_TYPE_PLAIN; +end; + {$IFDEF LAZARUS} initialization {$I UltraStar.lrs} diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index a6a91418..25ca370b 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -12,7 +12,8 @@ uses ULog, IniFiles, SysUtils, - Classes; + Classes, + UTexture; type TRGB = record @@ -40,7 +41,7 @@ type ColG: real; ColB: real; Tex: string; - Typ: string; + Typ: TTextureType; TexX1: real; TexY1: real; TexX2: real; @@ -84,7 +85,7 @@ type DColB: real; DInt: real; Tex: string; - Typ: string; + Typ: TTextureType; Visible: Boolean; @@ -550,15 +551,15 @@ type ChangeTextures: Boolean; FirstTexture: String; - FirstTyp: String; + FirstTyp: TTextureType; FirstColor: String; SecondTexture: String; - SecondTyp: String; + SecondTyp: TTextureType; SecondColor: String; ThirdTexture: String; - ThirdTyp: String; + ThirdTyp: TTextureType; ThirdColor: String; end; @@ -1309,17 +1310,16 @@ begin //Load Party Score DecoTextures Object PartyScore.DecoTextures.ChangeTextures := (ThemeIni.ReadInteger('PartyScoreDecoTextures', 'ChangeTextures', 0) = 1); - PartyScore.DecoTextures.FirstTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTexture', ''); - PartyScore.DecoTextures.FirstTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', 'Note Black'); + PartyScore.DecoTextures.FirstTyp := ParseTextureType(ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstTyp', ''), TEXTURE_TYPE_COLORIZED); PartyScore.DecoTextures.FirstColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'FirstColor', 'Black'); PartyScore.DecoTextures.SecondTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTexture', ''); - PartyScore.DecoTextures.SecondTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', 'Note Black'); + PartyScore.DecoTextures.SecondTyp := ParseTextureType(ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondTyp', ''), TEXTURE_TYPE_COLORIZED); PartyScore.DecoTextures.SecondColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'SecondColor', 'Black'); PartyScore.DecoTextures.ThirdTexture := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTexture', ''); - PartyScore.DecoTextures.ThirdTyp := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', 'Note Black'); + PartyScore.DecoTextures.ThirdTyp := ParseTextureType(ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdTyp', ''), TEXTURE_TYPE_COLORIZED); PartyScore.DecoTextures.ThirdColor := ThemeIni.ReadString('PartyScoreDecoTextures', 'ThirdColor', 'Black'); ThemeLoadText (PartyScore.TextWinner, 'PartyScoreTextWinner'); @@ -1503,7 +1503,7 @@ begin ThemeStatic.W := ThemeIni.ReadInteger(Name, 'W', 0); ThemeStatic.H := ThemeIni.ReadInteger(Name, 'H', 0); - ThemeStatic.Typ := ThemeIni.ReadString(Name, 'Type', ''); + ThemeStatic.Typ := ParseTextureType(ThemeIni.ReadString(Name, 'Type', ''), TEXTURE_TYPE_PLAIN); ThemeStatic.Color := ThemeIni.ReadString(Name, 'Color', ''); C := ColorExists(ThemeStatic.Color); @@ -1581,8 +1581,7 @@ begin ThemeButton.Z := ThemeIni.ReadFloat (Name, 'Z', 0); ThemeButton.W := ThemeIni.ReadInteger (Name, 'W', 0); ThemeButton.H := ThemeIni.ReadInteger (Name, 'H', 0); - - ThemeButton.Typ := ThemeIni.ReadString(Name, 'Type', ''); + ThemeButton.Typ := ParseTextureType(ThemeIni.ReadString(Name, 'Type', ''), TEXTURE_TYPE_PLAIN); //Reflection Mod ThemeButton.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); @@ -2112,7 +2111,7 @@ begin ThemeIni.WriteInteger(Name, 'H', ThemeStatic.H); ThemeIni.WriteString(Name, 'Tex', ThemeStatic.Tex); - ThemeIni.WriteString(Name, 'Type', ThemeStatic.Typ); + ThemeIni.WriteString(Name, 'Type', TextureTypeToStr(ThemeStatic.Typ)); ThemeIni.WriteString(Name, 'Color', ThemeStatic.Color); ThemeIni.WriteFloat(Name, 'TexX1', ThemeStatic.TexX1); @@ -2163,8 +2162,7 @@ begin ThemeIni.WriteInteger(Name, 'Y', ThemeButton.Y); ThemeIni.WriteInteger(Name, 'W', ThemeButton.W); ThemeIni.WriteInteger(Name, 'H', ThemeButton.H); - - ThemeIni.WriteString(Name, 'Type', ThemeButton.Typ); + ThemeIni.WriteString(Name, 'Type', TextureTypeToStr(ThemeButton.Typ)); ThemeIni.WriteInteger(Name, 'Texts', Length(ThemeButton.Text)); ThemeIni.WriteString(Name, 'Color', ThemeButton.Color); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 1d680f3d..7ac5f9b2 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -39,6 +39,8 @@ type OSD_LastError : String; + PrintScreenData: array[0..1024*768-1] of longword; + procedure DrawDebugInformation; public NextScreen : PMenu; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index b306fe9b..a4f9f9bf 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -62,31 +62,31 @@ type // static function AddStatic(ThemeStatic: TThemeStatic): integer; overload; - function AddStatic(X, Y, W, H: real; Name: string): integer; overload; - function AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; overload; - function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; overload; - function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; + function AddStatic(X, Y, W, H: real; const Name: string): integer; overload; + function AddStatic(X, Y, W, H: real; const Name, Format: string; Typ: TTextureType): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType): integer; overload; + function AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType; Color: integer): integer; overload; + function AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name, Format: string; Typ: TTextureType; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; overload; // text function AddText(ThemeText: TThemeText): integer; overload; - function AddText(X, Y: real; Tekst: string): integer; overload; - function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; overload; - function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; + function AddText(X, Y: real; const Text_: string): integer; overload; + function AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; overload; + function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string): integer; overload; // button Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; - function AddButton(X, Y, W, H: real; Name: String): integer; overload; - function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; - function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; + function AddButton(X, Y, W, H: real; const Name: String): integer; overload; + function AddButton(X, Y, W, H: real; const Name, Format: String; Typ: TTextureType; Reflection: Boolean): integer; overload; + function AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; const Name, Format: String; Typ: TTextureType; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; overload; procedure ClearButtons; - procedure AddButtonText(AddX, AddY: real; AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); overload; - procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; - procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; const AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); overload; + procedure AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); overload; + procedure AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); overload; // select function AddSelect(ThemeSelect: TThemeSelect; var Data: integer; Values: array of string): integer; overload; @@ -94,10 +94,10 @@ type TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; overload; - procedure AddSelectOption(AddX, AddY: real; AddText: string); overload; - procedure AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); overload; + const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Caption: string; var Data: integer): integer; overload; + procedure AddSelectOption(AddX, AddY: real; const AddText: string); overload; + procedure AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; const AddText: string); overload; procedure UpdateSelectOptions(ThemeSelect: TThemeSelect; SelectNum: integer; Values: array of string; var Data: integer); // select slide @@ -106,10 +106,10 @@ type TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; overload; - procedure AddSelectSlideOption(AddText: string); overload; - procedure AddSelectSlideOption(SelectNo: Cardinal; AddText: string); overload; + const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Caption: string; var Data: integer): integer; overload; + procedure AddSelectSlideOption(const AddText: string); overload; + procedure AddSelectSlideOption(SelectNo: Cardinal; const AddText: string); overload; procedure UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); @@ -197,8 +197,8 @@ begin inherited Create; if Back <> '' then begin -// BackImg := Texture.LoadTexture(true, PChar(Back), 'JPG', 'Plain', 0); - BackImg := Texture.LoadTexture(PChar(Back), 'JPG', 'Plain', 0); // new theme system +// BackImg := Texture.LoadTexture(true, PChar(Back), 'JPG', TEXTURE_TYPE_PLAIN, 0); + BackImg := Texture.LoadTexture(PChar(Back), 'JPG', TEXTURE_TYPE_PLAIN, 0); // new theme system BackImg.W := 800;//640; BackImg.H := 600;//480; BackW := 1; @@ -316,7 +316,7 @@ begin if fileexists( fFileName ) then begin - BackImg := Texture.GetTexture( fFileName , 'Plain'); + BackImg := Texture.GetTexture( fFileName , TEXTURE_TYPE_PLAIN); if ( BackImg.TexNum < 1 ) then begin @@ -352,29 +352,28 @@ end; procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); var BT, BTLen: Integer; - TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; + TempCol, TempDCol: Cardinal; begin if (Num > High(ButtonCollection)) then exit; -// colorize hack -if ThemeCollection.Style.Typ='Colorized' then -begin - TempR:=floor(255*ThemeCollection.Style.ColR); - TempG:=floor(255*ThemeCollection.Style.ColG); - TempB:=floor(255*ThemeCollection.Style.ColB); - TempR2:=floor(255*ThemeCollection.Style.DColR); - TempG2:=floor(255*ThemeCollection.Style.DColG); - TempB2:=floor(255*ThemeCollection.Style.DColB); - // give encoded color to loadtexture - ButtonCollection[Num] := TButtonCollection.Create(Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)), - Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.Tex)), 'JPG', 'Colorized', ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); + TempCol := 0; -// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture -end -else - ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture + // colorize hack + if (ThemeCollection.Style.Typ = TEXTURE_TYPE_COLORIZED) then + begin + TempCol := RGBFloatToInt(ThemeCollection.Style.ColR, ThemeCollection.Style.ColG, ThemeCollection.Style.ColB); + TempDCol := RGBFloatToInt(ThemeCollection.Style.DColR, ThemeCollection.Style.DColG, ThemeCollection.Style.DColB); + // give encoded color to loadtexture + ButtonCollection[Num] := TButtonCollection.Create( + Texture.LoadTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), 'JPG', TEXTURE_TYPE_COLORIZED, TempCol), + Texture.LoadTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), 'JPG', TEXTURE_TYPE_COLORIZED, TempDCol)); + + // Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture + end + else + ButtonCollection[Num] := TButtonCollection.Create(Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.Tex), ThemeCollection.Style.Typ, true)); // use cache texture //Set Parent menu ButtonCollection[Num].ScreenButton := @Self.Button; @@ -389,7 +388,7 @@ else ButtonCollection[Num].Y := ThemeCollection.Style.Y; ButtonCollection[Num].W := ThemeCollection.Style.W; ButtonCollection[Num].H := ThemeCollection.Style.H; - if ThemeCollection.Style.Typ <> 'Colorized' then begin + if (ThemeCollection.Style.Typ <> TEXTURE_TYPE_COLORIZED) then begin ButtonCollection[Num].SelectColR := ThemeCollection.Style.ColR; ButtonCollection[Num].SelectColG := ThemeCollection.Style.ColG; ButtonCollection[Num].SelectColB := ThemeCollection.Style.ColB; @@ -417,8 +416,9 @@ else ButtonCollection[Num].Fade := ThemeCollection.Style.Fade; ButtonCollection[Num].FadeText := ThemeCollection.Style.FadeText; - if ThemeCollection.Style.Typ='Colorized' then - ButtonCollection[Num].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)) + if (ThemeCollection.Style.Typ = TEXTURE_TYPE_COLORIZED) then + ButtonCollection[Num].FadeTex := Texture.LoadTexture( + PChar(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex)), 'JPG', TEXTURE_TYPE_COLORIZED, TempCol) else ButtonCollection[Num].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeCollection.Style.FadeTex), ThemeCollection.Style.Typ, true); ButtonCollection[Num].FadeTexPos := ThemeCollection.Style.FadeTexPos; @@ -438,39 +438,39 @@ begin Result := AddStatic(ThemeStatic.X, ThemeStatic.Y, ThemeStatic.W, ThemeStatic.H, ThemeStatic.Z, ThemeStatic.ColR, ThemeStatic.ColG, ThemeStatic.ColB, ThemeStatic.TexX1, ThemeStatic.TexY1, ThemeStatic.TexX2, ThemeStatic.TexY2, - {<0.5.1: Skin.SkinPath + ThemeStatic.Tex, 0.5.1:} Skin.GetTextureFileName(ThemeStatic.Tex), + Skin.GetTextureFileName(ThemeStatic.Tex), 'JPG', ThemeStatic.Typ, $FFFFFF, ThemeStatic.Reflection, ThemeStatic.Reflectionspacing); end; -function TMenu.AddStatic(X, Y, W, H: real; Name: string): integer; +function TMenu.AddStatic(X, Y, W, H: real; const Name: string): integer; begin - Result := AddStatic(X, Y, W, H, Name, 'JPG', 'Plain'); + Result := AddStatic(X, Y, W, H, Name, 'JPG', TEXTURE_TYPE_PLAIN); end; -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType): integer; var StatNum: integer; begin Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType): integer; var StatNum: integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H: real; Name, Format, Typ: string): integer; +function TMenu.AddStatic(X, Y, W, H: real; const Name, Format: string; Typ: TTextureType): integer; var StatNum: integer; begin // adds static StatNum := Length(Static); SetLength(Static, StatNum + 1); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // $FFFFFF -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin system - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), $FF00FF)); // new skin +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), Typ, $FF00FF)); // $FFFFFF +// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), Typ, $FF00FF)); // new skin system + Static[StatNum] := TStatic.Create(Texture.LoadTexture(Name, Format, Typ, $FF00FF)); // new skin // configures static Static[StatNum].Texture.X := X; @@ -481,43 +481,36 @@ begin Result := StatNum; end; -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType; Color: integer): integer; var StatNum: integer; begin Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Format, Typ, Color); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name, Format: string; Typ: TTextureType; Color: integer): integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Format, Typ, Color, False, 0); // end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; Name, Format, Typ: string; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name, Format: string; Typ: TTextureType; Color: integer; Reflection: Boolean; ReflectionSpacing: Real): integer; var StatNum: integer; - TempR, TempG, TempB: Cardinal; - TempCol: Cardinal; begin // adds static StatNum := Length(Static); SetLength(Static, StatNum + 1); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); -// Static[StatNum] := TStatic.Create(Texture.LoadTexture(Skin.SkinReg, PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin system - -// colorize hack -if Typ='Colorized' then -begin - TempR:=floor(255*ColR); - TempG:=floor(255*ColG); - TempB:=floor(255*ColB); - // give encoded color to loadtexture - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB))); -end -else - Static[StatNum] := TStatic.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), Color)); // new skin -// Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); + + // colorize hack + if (Typ = TEXTURE_TYPE_COLORIZED) then + begin + // give encoded color to loadtexture + Static[StatNum] := TStatic.Create(Texture.LoadTexture(Name, Format, Typ, RGBFloatToInt(ColR, ColG, ColB))); + end + else + Static[StatNum] := TStatic.Create(Texture.LoadTexture(Name, Format, Typ, Color)); // new skin + // Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ)); // configures static Static[StatNum].Texture.X := X; @@ -525,7 +518,7 @@ else Static[StatNum].Texture.W := W; Static[StatNum].Texture.H := H; Static[StatNum].Texture.Z := Z; - if Typ <> 'Colorized' then begin + if (Typ <> TEXTURE_TYPE_COLORIZED) then begin Static[StatNum].Texture.ColR := ColR; Static[StatNum].Texture.ColG := ColG; Static[StatNum].Texture.ColB := ColB; @@ -550,30 +543,30 @@ begin ThemeText.ColR, ThemeText.ColG, ThemeText.ColB, ThemeText.Align, ThemeText.Text); end; -function TMenu.AddText(X, Y: real; Tekst: string): integer; +function TMenu.AddText(X, Y: real; const Text_: string): integer; var TextNum: integer; begin // adds text TextNum := Length(Text); SetLength(Text, TextNum + 1); - Text[TextNum] := TText.Create(X, Y, Tekst); + Text[TextNum] := TText.Create(X, Y, Text_); Result := TextNum; end; -function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; Tekst: string): integer; +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; begin - Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Tekst); + Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text); end; -function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string): integer; var TextNum: integer; begin // adds text TextNum := Length(Text); SetLength(Text, TextNum + 1); - Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Tekst); + Text[TextNum] := TText.Create(X, Y, W, Style, Size, ColR, ColG, ColB, Align, Text_); Result := TextNum; end; @@ -616,11 +609,9 @@ begin Button[Result].Fade := ThemeButton.Fade; Button[Result].FadeText := ThemeButton.FadeText; - if ThemeButton.Typ='Colorized' then begin - TempR:=floor(255*ThemeButton.ColR); - TempG:=floor(255*ThemeButton.ColG); - TempB:=floor(255*ThemeButton.ColB); - Button[Result].FadeTex := Texture.LoadTexture(PChar(Skin.GetTextureFileName(ThemeButton.FadeTex)), 'JPG', 'Colorized', ((((TempR shl 8) or TempG) shl 8)or TempB)); + if (ThemeButton.Typ = TEXTURE_TYPE_COLORIZED) then begin + Button[Result].FadeTex := Texture.LoadTexture( + Skin.GetTextureFileName(ThemeButton.FadeTex), 'JPG', TEXTURE_TYPE_COLORIZED, RGBFloatToInt(ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB)); end else Button[Result].FadeTex := Texture.GetTexture(Skin.GetTextureFileName(ThemeButton.FadeTex), ThemeButton.Typ, true); @@ -652,20 +643,23 @@ begin Button[Result].Texture.Alpha := 0; end; end; + Log.BenchmarkEnd(6); + Log.LogBenchmark('====> Screen Options32', 6); end; -function TMenu.AddButton(X, Y, W, H: real; Name: String): integer; +function TMenu.AddButton(X, Y, W, H: real; const Name: String): integer; begin - Result := AddButton(X, Y, W, H, Name, 'JPG', 'Plain', False); + Result := AddButton(X, Y, W, H, Name, 'JPG', TEXTURE_TYPE_PLAIN, False); end; -function TMenu.AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; +function TMenu.AddButton(X, Y, W, H: real; const Name, Format: String; Typ: TTextureType; Reflection: Boolean): integer; begin - Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', 'Plain', Reflection, 15, 15); + Result := AddButton(X, Y, W, H, 1, 1, 1, 1, 1, 1, 1, 0.5, Name, 'JPG', TEXTURE_TYPE_PLAIN, Reflection, 15, 15); end; -function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; Name, Format, Typ: String; Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; -var TempR, TempG, TempB, TempR2, TempG2, TempB2: Cardinal; +function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; + const Name, Format: String; Typ: TTextureType; + Reflection: Boolean; ReflectionSpacing, DeSelectReflectionSpacing: Real): integer; begin // adds button //SetLength is used once to reduce Memory usement @@ -679,38 +673,32 @@ begin Result := Length(Button); SetLength(Button, Result + 1); end; -// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); + // Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ)); // check here for cache -// Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed -// if Covers.CoverExists(Name) then -// colorize hack -if Typ='Colorized' then -begin - TempR:=floor(255*ColR); - TempG:=floor(255*ColG); - TempB:=floor(255*ColB); - TempR2:=floor(255*DColR); - TempG2:=floor(255*DColG); - TempB2:=floor(255*DColB); - // give encoded color to loadtexture - Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR shl 8) or TempG) shl 8)or TempB)), - Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); - -// Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture -end -else - - Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture -// else -// Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} + // Texture.GetTexture(Name, Typ, false); // preloads textures and creates cahce mipmap when needed + // if Covers.CoverExists(Name) then + // colorize hack + if (Typ = TEXTURE_TYPE_COLORIZED) then + begin + // give encoded color to loadtexture + Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), Typ, RGBFloatToInt(ColR, ColG, ColB)), + Texture.LoadTexture(PChar(Name), PChar(Format), Typ, RGBFloatToInt(DColR, DColG, DColB))); + + // Button[Result] := TButton.Create(Texture.LoadTexture(PChar(Name), PChar(Format), PChar(Typ), ((((TempR2 shl 8) or TempG2) shl 8)or TempB2))); // use cache texture + end + else + + Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, true)); // use cache texture + // else + // Button[Result] := TButton.Create(Texture.GetTexture(Name, Typ, false)); // don't use cache texture} // configures button Button[Result].X := X; Button[Result].Y := Y; Button[Result].W := W; Button[Result].H := H; - if Typ <> 'Colorized' then begin + if (Typ <> TEXTURE_TYPE_COLORIZED) then begin Button[Result].SelectColR := ColR; Button[Result].SelectColG := ColG; Button[Result].SelectColB := ColB; @@ -785,6 +773,7 @@ begin VideoPlayback.DrawGL(2); end; + Result := true; end; function TMenu.DrawFG: boolean; @@ -1003,12 +992,12 @@ begin ScreenPopupCheck.ShowPopup(msg); end; -procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; const AddText: string); begin AddButtonText(AddX, AddY, 1, 1, 1, AddText); end; -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; const AddText: string); var Il: integer; begin @@ -1023,7 +1012,7 @@ begin end; end; -procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +procedure TMenu.AddButtonText(AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); var Il: integer; begin @@ -1041,7 +1030,7 @@ begin end; end; -procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; AddText: string); +procedure TMenu.AddButtonText(CustomButton: TButton; AddX, AddY: real; ColR, ColG, ColB: real; Font: integer; Size: integer; Align: integer; const AddText: string); var Il: integer; begin @@ -1083,8 +1072,8 @@ function TMenu.AddSelect(X, Y, W, H, SkipX, ColR, ColG, ColB, Int, DColR, DColG, TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; + const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Caption: string; var Data: integer): integer; var S: integer; begin @@ -1093,7 +1082,7 @@ begin Selects[S] := TSelect.Create; if (Typ = TEXTURE_TYPE_COLORIZED) then - Selects[S].Texture := Texture.LoadTexture(PChar(Name), 'PNG', PChar(Typ), RGBFloatToInt(ColR, ColG, ColB)) + Selects[S].Texture := Texture.LoadTexture(PChar(Name), 'PNG', Typ, RGBFloatToInt(ColR, ColG, ColB)) else Selects[S].Texture := Texture.GetTexture(Name, Typ); Selects[S].X := X; @@ -1110,7 +1099,7 @@ begin Selects[S].DInt := DInt; if (SBGTyp = TEXTURE_TYPE_COLORIZED) then - Selects[S].TextureSBG := Texture.LoadTexture(PChar(SBGName), 'PNG', PChar(SBGTyp), RGBFloatToInt(SBGColR, SBGColG, SBGColB)) + Selects[S].TextureSBG := Texture.LoadTexture(PChar(SBGName), 'PNG', SBGTyp, RGBFloatToInt(SBGColR, SBGColG, SBGColB)) else Selects[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); Selects[S].TextureSBG.X := X + W + SkipX; @@ -1172,12 +1161,12 @@ begin AddInteraction(iSelect, S); end; -procedure TMenu.AddSelectOption(AddX, AddY: real; AddText: string); +procedure TMenu.AddSelectOption(AddX, AddY: real; const AddText: string); begin AddSelectOption (High(Selects), AddX, AddY, AddText); end; -procedure TMenu.AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; AddText: string); +procedure TMenu.AddSelectOption(SelectNo: Cardinal; AddX, AddY: real; const AddText: string); var SO: integer; begin @@ -1242,8 +1231,8 @@ function TMenu.AddSelectSlide(X, Y, W, H, SkipX, SBGW, ColR, ColG, ColB, Int, DC TColR, TColG, TColB, TInt, TDColR, TDColG, TDColB, TDInt, SBGColR, SBGColG, SBGColB, SBGInt, SBGDColR, SBGDColG, SBGDColB, SBGDInt, STColR, STColG, STColB, STInt, STDColR, STDColG, STDColB, STDInt: real; - Name, Typ: String; SBGName, SBGTyp: String; - Caption: string; var Data: integer): integer; + const Name: String; Typ: TTextureType; const SBGName: String; SBGTyp: TTextureType; + const Caption: string; var Data: integer): integer; var S: integer; I: integer; @@ -1253,7 +1242,7 @@ begin SelectsS[S] := TSelectSlide.Create; if (Typ = TEXTURE_TYPE_COLORIZED) then - SelectsS[S].Texture := Texture.LoadTexture(PChar(Name), 'PNG', PChar(Typ), RGBFloatToInt(ColR, ColG, ColB)) + SelectsS[S].Texture := Texture.LoadTexture(PChar(Name), 'PNG', Typ, RGBFloatToInt(ColR, ColG, ColB)) else SelectsS[S].Texture := Texture.GetTexture(Name, Typ); SelectsS[S].X := X; @@ -1271,7 +1260,7 @@ begin SelectsS[S].DInt := DInt; if (SBGTyp = TEXTURE_TYPE_COLORIZED) then - SelectsS[S].TextureSBG := Texture.LoadTexture(PChar(SBGName), 'PNG', PChar(SBGTyp), RGBFloatToInt(SBGColR, SBGColG, SBGColB)) + SelectsS[S].TextureSBG := Texture.LoadTexture(PChar(SBGName), 'PNG', SBGTyp, RGBFloatToInt(SBGColR, SBGColG, SBGColB)) else SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); SelectsS[S].TextureSBG.X := X + W + SkipX; @@ -1362,12 +1351,12 @@ begin Result := S; end; -procedure TMenu.AddSelectSlideOption(AddText: string); +procedure TMenu.AddSelectSlideOption(const AddText: string); begin AddSelectSlideOption(High(SelectsS), AddText); end; -procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; AddText: string); +procedure TMenu.AddSelectSlideOption(SelectNo: Cardinal; const AddText: string); var SO: integer; begin @@ -1536,8 +1525,8 @@ end; procedure TMenu.AddBox(X, Y, W, H: real); begin - AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); end; procedure TMenu.onShow; diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 2cf78d12..a95ef256 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -188,32 +188,32 @@ constructor TScreenCredits.Create; begin inherited Create; - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', 'Plain', 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', 'Transparent', 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', 'Font Black', 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', 'Font Black', 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', 'Font Black', 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', 'Font Black', 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', 'Font Black', 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', 'Font Black', 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', 'Font Black', 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', 'Font Black', 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', 'Font Black', 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', 'Transparent', 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', 'Transparent', 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', 'Transparent', 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', 'Transparent', 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', 'Transparent', 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', 'Transparent', 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', 'Transparent', 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', 'Transparent', 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', 'Transparent', 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', 'Plain', 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', 'Transparent', 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', 'Transparent', 0); + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', 'PNG', TEXTURE_TYPE_PLAIN, 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', 'PNG', TEXTURE_TYPE_PLAIN, 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', 'PNG', TEXTURE_TYPE_TRANSPARENT, 0); CRDTS_Stage:=InitialDelay; end; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index f0e0a7b7..2b48de88 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -50,7 +50,7 @@ type implementation -uses UGraphic, UMusic, SysUtils, UFiles, USkins; +uses UGraphic, UMusic, SysUtils, UFiles, USkins, UTexture; function TScreenEditHeader.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; var @@ -184,18 +184,18 @@ begin TextGAP := AddText(340, 110 + 13*30, 0, 10, 0, 0, 0, ''); TextBPM := AddText(340, 110 + 14*30, 0, 10, 0, 0, 0, ''); - StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); - StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', 'Transparent', $FF00FF); + StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', 'BMP', TEXTURE_TYPE_TRANSPARENT, $FF00FF); AddInteraction(iText, TextTitle); AddInteraction(iText, TextArtist); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 51fd6ebc..743fd45d 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1115,18 +1115,18 @@ begin SetLength(Player, 1); // linijka - AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', TEXTURE_TYPE_COLORIZED); AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); // Note - AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', 'Font Black'); + AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), 'JPG', TEXTURE_TYPE_COLORIZED); AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); // file info - AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 3a15f26f..716f7f5f 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -106,8 +106,8 @@ end; procedure TScreenOpen.AddBox(X, Y, W, H: real); begin - AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); - AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('Bar'), 'JPG', 'Font Black'); + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('MainBar'), 'JPG', TEXTURE_TYPE_COLORIZED); end; constructor TScreenOpen.Create; @@ -115,7 +115,7 @@ begin inherited Create; // linijka -{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'Bar', 'JPG', 'Font Black'); +{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); AddText(35, 17, 1, 6, 1, 1, 1, 'Linijka'); TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');} diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index c1a84ee6..0c4f2c66 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -125,7 +125,7 @@ begin DecoColor[0].B := B; //Load Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.FirstTyp), Color); + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), 'JPG', Theme.PartyScore.DecoTextures.FirstTyp, Color); DecoTex[0] := Tex.TexNum; //Get Second Color @@ -136,7 +136,7 @@ begin DecoColor[1].B := B; //Load Second Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.SecondTyp), Color); + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), 'JPG', Theme.PartyScore.DecoTextures.SecondTyp, Color); DecoTex[1] := Tex.TexNum; //Get Third Color @@ -147,7 +147,7 @@ begin DecoColor[2].B := B; //Load Third Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), 'JPG', PChar(Theme.PartyScore.DecoTextures.ThirdTyp), Color); + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), 'JPG', Theme.PartyScore.DecoTextures.ThirdTyp, Color); DecoTex[2] := Tex.TexNum; end; diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 5c5f8cee..9ce60864 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -86,7 +86,7 @@ var CustomSounds: array of TCustomSoundEntry; //Procedured for Plugin -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; //function Translate (const Name: PChar): PChar; stdcall; procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound @@ -633,7 +633,7 @@ Winner := DllMan.PluginFinish(PlayerInfo); //DLLMan.UnLoadPlugin; end; -function LoadTex (const Name, Typ: PChar): TsmallTexture; stdcall; +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; var Texname, EXT: String; Tex: TTexture; @@ -647,7 +647,7 @@ begin else Ext := 'BMP'; - Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), Typ, 0); + Tex := Texture.LoadTexture(PChar(TexName), PChar(Ext), UTexture.TTextureType(Typ), 0); Result.TexNum := Tex.TexNum; Result.W := Tex.W; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index aed13212..4afea262 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -198,10 +198,10 @@ var I, I2: Integer; //Change Text[TextCat].Text := CatSongs.Song[Cat].Artist; //showmessage(CatSongs.Song[Cat].Path + CatSongs.Song[Cat].Cover); - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', true); - //Texture.GetTexture(Button[Cat].Texture.Name, 'Plain', false); + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); + //Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, false); //Button[Cat]. //Cover @@ -812,13 +812,13 @@ begin CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' // to - do : new Song management if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections) else begin // cache texture if there is a need to this if not Covers.CoverExists({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover) then begin Texture.CreateCacheMipmap := true; - Texture.GetTexture({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.GetTexture({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, TEXTURE_TYPE_PLAIN, true); // preloads textures and creates cache mipmap Texture.CreateCacheMipmap := false; // puts this texture to the cache file @@ -831,7 +831,7 @@ begin end; // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200,{ CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + AddButton(300 + Pet*250, 140, 200, 200,{ CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, 'JPG', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections); end; Texture.Limit := 1024*1024; I := -1; @@ -851,7 +851,7 @@ begin begin Log.LogError('NoCover Cover is damaged!'); try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections); except {$IFDEF MSWINDOWS} Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); @@ -1572,9 +1572,9 @@ begin if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then begin // load new texture - Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); Button[Interaction].Texture.Alpha := 1; - Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); Button[Interaction].Texture2.Alpha := 1; end; // to - do : new Song management @@ -1662,7 +1662,7 @@ begin end; // Interaction -> Button, ktorego okladke przeczytamy - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); // 0.5.0: show uncached texture end; procedure TScreenSong.SelectPrev; @@ -1690,7 +1690,7 @@ begin SongCurrent := SongCurrent + CatSongs.VisibleSongs; end; - // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); // 0.5.0: show uncached texture + // Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); // 0.5.0: show uncached texture end; end; @@ -2079,7 +2079,7 @@ procedure TScreenSong.UnLoadDetailedCover; begin CoverTime := 0; - Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', true); // 0.5.0: show cached texture + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, true); // 0.5.0: show cached texture Button[Interaction].Texture2.Alpha := 0; if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then diff --git a/Game/Code/Screens/UScreenWelcome.pas b/Game/Code/Screens/UScreenWelcome.pas index c9c10e57..11e54b8e 100644 --- a/Game/Code/Screens/UScreenWelcome.pas +++ b/Game/Code/Screens/UScreenWelcome.pas @@ -20,7 +20,7 @@ type implementation -uses UGraphic, UTime, USkins; +uses UGraphic, UTime, USkins, UTexture; function TScreenWelcome.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin @@ -44,12 +44,12 @@ end; constructor TScreenWelcome.Create; begin inherited Create; - AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt') , 'JPG', 'Transparent'); - AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); - AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); - AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); - AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); - AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', 'Font Black'); + AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt') , 'JPG', TEXTURE_TYPE_TRANSPARENT); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), 'JPG', TEXTURE_TYPE_COLORIZED); Animation := 0; Fadeout := false; end; diff --git a/Game/Graphics/names_blindguard.png b/Game/Graphics/names_blindguard.png index a236548c..a19f1b03 100644 Binary files a/Game/Graphics/names_blindguard.png and b/Game/Graphics/names_blindguard.png differ diff --git a/Game/Graphics/names_blindy.png b/Game/Graphics/names_blindy.png index 2d2a0a01..828e54cb 100644 Binary files a/Game/Graphics/names_blindy.png and b/Game/Graphics/names_blindy.png differ diff --git a/Game/Graphics/names_canni.png b/Game/Graphics/names_canni.png index 7dee63da..7881937a 100644 Binary files a/Game/Graphics/names_canni.png and b/Game/Graphics/names_canni.png differ diff --git a/Game/Graphics/names_commandio.png b/Game/Graphics/names_commandio.png index e0d39f89..12214cb0 100644 Binary files a/Game/Graphics/names_commandio.png and b/Game/Graphics/names_commandio.png differ diff --git a/Game/Graphics/names_lazyjoker.png b/Game/Graphics/names_lazyjoker.png index 6d76cfe7..6d8a8a08 100644 Binary files a/Game/Graphics/names_lazyjoker.png and b/Game/Graphics/names_lazyjoker.png differ diff --git a/Game/Graphics/names_mog.png b/Game/Graphics/names_mog.png index 7521c647..2cebc464 100644 Binary files a/Game/Graphics/names_mog.png and b/Game/Graphics/names_mog.png differ diff --git a/Game/Graphics/names_mota.png b/Game/Graphics/names_mota.png index a55a33cb..0263f71b 100644 Binary files a/Game/Graphics/names_mota.png and b/Game/Graphics/names_mota.png differ diff --git a/Game/Graphics/names_skillmaster.png b/Game/Graphics/names_skillmaster.png index 9f440846..9f92cb6b 100644 Binary files a/Game/Graphics/names_skillmaster.png and b/Game/Graphics/names_skillmaster.png differ diff --git a/Game/Graphics/names_whiteshark.png b/Game/Graphics/names_whiteshark.png index 2eda5f04..71b7d58c 100644 Binary files a/Game/Graphics/names_whiteshark.png and b/Game/Graphics/names_whiteshark.png differ diff --git a/Modis/Don't_Get_Worse/Hold_The_Line.dpr b/Modis/Don't_Get_Worse/Hold_The_Line.dpr index de19858b..27b9c3df 100644 --- a/Modis/Don't_Get_Worse/Hold_The_Line.dpr +++ b/Modis/Don't_Get_Worse/Hold_The_Line.dpr @@ -58,14 +58,14 @@ end; function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; var I: Integer; - Texname, TexType: PChar; + Texname: PChar; + TexType: TTextureType; begin TexName := CreateStr(PChar('HDL_Pointer')); - TexType := CreateStr(PChar('Font Black')); + TexType := TEXTURE_TYPE_TRANSPARENT; PointerTex := Methods.LoadTex(TexName, TexType); FreeStr(TexName); - FreeStr(TexType); TexName := CreateStr(PChar('dismissed.mp3')); DismissedSound := Methods.LoadSound (TexName); @@ -209,4 +209,4 @@ PluginInfo, Init, Draw, Finish; begin -end. \ No newline at end of file +end. diff --git a/Modis/SDK/ModiSDK.pas b/Modis/SDK/ModiSDK.pas index 517e4b2b..260d6324 100644 --- a/Modis/SDK/ModiSDK.pas +++ b/Modis/SDK/ModiSDK.pas @@ -121,8 +121,14 @@ type //PluginInfo, for Init DWORD = Longword; HSTREAM = DWORD; + TTextureType = ( + TEXTURE_TYPE_PLAIN, // Plain (alpha = 1) + TEXTURE_TYPE_TRANSPARENT, // Alpha is used + TEXTURE_TYPE_COLORIZED // Alpha is used; Hue of the HSV color-model will be replaced by a new value + ); + //Routines to gave to the Plugin - fModi_LoadTex = function (const Name, Typ: PChar): TsmallTexture; stdcall; //Pointer to Texture Loader + fModi_LoadTex = function (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; //Pointer to Texture Loader //fModi_Translate = function (const Name, Translation: AChar): Integer; stdcall; //Pointer to Translator fModi_Print = procedure (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text //Now translated automatically fModi_LoadSound = function (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -- cgit v1.2.3