42 // like LoadDataImage but uses altFile as fallback-filename if file cannot be loaded |
42 // like LoadDataImage but uses altFile as fallback-filename if file cannot be loaded |
43 function LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface; |
43 function LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface; |
44 |
44 |
45 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring); |
45 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring); |
46 procedure LoadHedgehogHat2(var HH: THedgehog; newHat: shortstring; allowSurfReuse: boolean); |
46 procedure LoadHedgehogHat2(var HH: THedgehog; newHat: shortstring; allowSurfReuse: boolean); |
|
47 |
|
48 procedure LoadDefaultClanColors(s: shortstring); |
47 |
49 |
48 procedure InitZoom(zoom: real); |
50 procedure InitZoom(zoom: real); |
49 |
51 |
50 procedure SetupOpenGL; |
52 procedure SetupOpenGL; |
51 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; |
53 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; |
763 else |
765 else |
764 freeTmpHatSurf(); |
766 freeTmpHatSurf(); |
765 end; |
767 end; |
766 end; |
768 end; |
767 |
769 |
|
770 // Load default clan colors from config fiile |
|
771 procedure LoadDefaultClanColors(s: shortstring); |
|
772 var i: LongInt; |
|
773 f: PFSFile; |
|
774 key, value, l, temp: shortstring; |
|
775 color: Longword; |
|
776 c: byte; |
|
777 begin |
|
778 if cOnlyStats then exit; |
|
779 |
|
780 WriteLnToConsole('Loading default clan colors from: ' + s); |
|
781 |
|
782 l:= ''; |
|
783 if pfsExists(s) then |
|
784 begin |
|
785 f:= pfsOpenRead(s); |
|
786 while (not pfsEOF(f)) and (l <> '[colors]') do |
|
787 pfsReadLn(f, l); |
|
788 |
|
789 while (not pfsEOF(f)) and (l <> '') do |
|
790 begin |
|
791 pfsReadLn(f, l); |
|
792 |
|
793 key:= ''; |
|
794 i:= 1; |
|
795 while (i <= length(l)) and (l[i] <> '=') do |
|
796 begin |
|
797 key:= key + l[i]; |
|
798 inc(i) |
|
799 end; |
|
800 temp:= copy(key, 1, 5); |
|
801 if temp = 'color' then |
|
802 begin |
|
803 temp:= copy(key, 6, length(key) - 5); |
|
804 try |
|
805 c:= StrToInt(temp); |
|
806 except |
|
807 on E : EConvertError do continue; |
|
808 end; |
|
809 end |
|
810 else |
|
811 continue; |
|
812 |
|
813 if i < length(l) then |
|
814 begin |
|
815 value:= copy(l, i + 1, length(l) - i); |
|
816 if (length(value) = 2) and (value[1] = '\') then |
|
817 value:= value[1] + '' |
|
818 else if (value[1] = '"') and (value[length(value)] = '"') then |
|
819 value:= copy(value, 2, length(value) - 2); |
|
820 if value[1] <> '#' then |
|
821 continue; |
|
822 temp:= copy(value, 2, length(value) - 1); |
|
823 try |
|
824 color:= StrToInt('0x'+temp); |
|
825 except |
|
826 on E : EConvertError do continue; |
|
827 end; |
|
828 end; |
|
829 |
|
830 if c <= cClanColors then |
|
831 ClanColorArray[c]:= color; |
|
832 |
|
833 end; |
|
834 |
|
835 pfsClose(f) |
|
836 end |
|
837 else |
|
838 WriteLnToConsole('Settings file not found'); |
|
839 end; |
|
840 |
|
841 |
768 procedure SetupOpenGLAttributes; |
842 procedure SetupOpenGLAttributes; |
769 begin |
843 begin |
770 {$IFDEF IPHONEOS} |
844 {$IFDEF IPHONEOS} |
771 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); |
845 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); |
772 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |
846 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |