31 procedure StoreRelease(reload: boolean); |
31 procedure StoreRelease(reload: boolean); |
32 procedure RenderHealth(var Hedgehog: THedgehog); |
32 procedure RenderHealth(var Hedgehog: THedgehog); |
33 function makeHealthBarTexture(w, h, Color: Longword): PTexture; |
33 function makeHealthBarTexture(w, h, Color: Longword): PTexture; |
34 procedure AddProgress; |
34 procedure AddProgress; |
35 procedure FinishProgress; |
35 procedure FinishProgress; |
|
36 procedure LoadFont(font: THWFont); |
36 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
37 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
37 |
38 |
38 // loads an image from the games data files |
39 // loads an image from the games data files |
39 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
40 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
40 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path |
41 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path |
353 GraveTex:= Surface2Tex(texsurf, false); |
354 GraveTex:= Surface2Tex(texsurf, false); |
354 SDL_FreeSurface(texsurf) |
355 SDL_FreeSurface(texsurf) |
355 end |
356 end |
356 end; |
357 end; |
357 |
358 |
|
359 procedure LoadFont(font: THWFont); |
|
360 var s: shortstring; |
|
361 begin |
|
362 with Fontz[font] do |
|
363 begin |
|
364 if Handle <> nil then |
|
365 begin |
|
366 TTF_CloseFont(Handle); |
|
367 Handle:= nil; |
|
368 end; |
|
369 s:= cPathz[ptFonts] + '/' + Name; |
|
370 WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); |
|
371 Handle:= TTF_OpenFontRW(rwopsOpenRead(s), true, Height); |
|
372 if SDLCheck(Handle <> nil, 'TTF_OpenFontRW', true) then exit; |
|
373 TTF_SetFontStyle(Handle, style); |
|
374 WriteLnToConsole(msgOK) |
|
375 end; |
|
376 end; |
|
377 |
358 procedure LoadFonts(); |
378 procedure LoadFonts(); |
359 var s: shortstring; |
379 var fi: THWFont; |
360 fi: THWFont; |
|
361 begin |
380 begin |
362 AddFileLog('LoadFonts();'); |
381 AddFileLog('LoadFonts();'); |
363 |
382 |
364 if (not cOnlyStats) then |
383 if (not cOnlyStats) then |
365 for fi:= Low(THWFont) to High(THWFont) do |
384 for fi:= Low(THWFont) to High(THWFont) do |
366 with Fontz[fi] do |
385 begin |
367 begin |
386 LoadFont(fi); |
368 s:= cPathz[ptFonts] + '/' + Name; |
387 end; |
369 WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); |
|
370 Handle:= TTF_OpenFontRW(rwopsOpenRead(s), true, Height); |
|
371 if SDLCheck(Handle <> nil, 'TTF_OpenFontRW', true) then exit; |
|
372 TTF_SetFontStyle(Handle, style); |
|
373 WriteLnToConsole(msgOK) |
|
374 end; |
|
375 end; |
388 end; |
376 |
389 |
377 procedure StoreLoad(reload: boolean); |
390 procedure StoreLoad(reload: boolean); |
378 var ii: TSprite; |
391 var ii: TSprite; |
379 ai: TAmmoType; |
392 ai: TAmmoType; |