hedgewars/uStore.pas
changeset 7754 e81dc9bef8b8
parent 7716 95117607b81a
child 7866 58d10edc5d21
equal deleted inserted replaced
7753:dda33caa609d 7754:e81dc9bef8b8
    38 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path
    38 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path
    39 function  LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    39 function  LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
    40 // like LoadDataImage but uses altFile as fallback-filename if file cannot be loaded
    40 // like LoadDataImage but uses altFile as fallback-filename if file cannot be loaded
    41 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    41 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    42 
    42 
    43 procedure LoadHedgehogHat(HHGear: PGear; newHat: shortstring);
    43 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
    44 procedure SetupOpenGL;
    44 procedure SetupOpenGL;
    45 procedure SetScale(f: GLfloat);
    45 procedure SetScale(f: GLfloat);
    46 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    46 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    47 procedure RenderWeaponTooltip(atype: TAmmoType);
    47 procedure RenderWeaponTooltip(atype: TAmmoType);
    48 procedure ShowWeaponTooltip(x, y: LongInt);
    48 procedure ShowWeaponTooltip(x, y: LongInt);
   242                     begin
   242                     begin
   243                     NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth);
   243                     NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth);
   244                     if Hat <> 'NoHat' then
   244                     if Hat <> 'NoHat' then
   245                         begin
   245                         begin
   246                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   246                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   247                             LoadHedgehogHat(Gear, 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
   247                             LoadHedgehogHat(Hedgehogs[i], 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
   248                         else
   248                         else
   249                             LoadHedgehogHat(Gear, Hat);
   249                             LoadHedgehogHat(Hedgehogs[i], Hat);
   250                         end
   250                         end
   251                     end;
   251                     end;
   252         end;
   252         end;
   253     MissionIcons:= LoadDataImage(ptGraphics, 'missions', ifCritical);
   253     MissionIcons:= LoadDataImage(ptGraphics, 'missions', ifCritical);
   254     iconsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, 28, 28, 32, RMask, GMask, BMask, AMask);
   254     iconsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, 28, 28, 32, RMask, GMask, BMask, AMask);
   638         tmpsurf:= LoadDataImage(path, altFile, imageFlags);
   638         tmpsurf:= LoadDataImage(path, altFile, imageFlags);
   639 
   639 
   640     LoadDataImageAltFile:= tmpsurf;
   640     LoadDataImageAltFile:= tmpsurf;
   641 end;
   641 end;
   642 
   642 
   643 procedure LoadHedgehogHat(HHGear: PGear; newHat: shortstring);
   643 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
   644 var texsurf: PSDL_Surface;
   644 var texsurf: PSDL_Surface;
   645 begin
   645 begin
   646     texsurf:= LoadDataImage(ptHats, newHat, ifNone);
   646     texsurf:= LoadDataImage(ptHats, newHat, ifNone);
   647 
   647 AddFileLog('Hat => '+newHat);
   648     // only do something if the hat could be loaded
   648     // only do something if the hat could be loaded
   649     if texsurf <> nil then
   649     if texsurf <> nil then
   650         begin
   650         begin
       
   651 AddFileLog('Got Hat');
   651         // free the mem of any previously assigned texture
   652         // free the mem of any previously assigned texture
   652         FreeTexture(HHGear^.Hedgehog^.HatTex);
   653         FreeTexture(HH.HatTex);
   653 
   654 
   654         // assign new hat to hedgehog
   655         // assign new hat to hedgehog
   655         HHGear^.Hedgehog^.HatTex:= Surface2Tex(texsurf, true);
   656         HH.HatTex:= Surface2Tex(texsurf, true);
   656 
   657 
   657         // cleanup: free temporary surface mem
   658         // cleanup: free temporary surface mem
   658         SDL_FreeSurface(texsurf)
   659         SDL_FreeSurface(texsurf)
   659         end;
   660         end;
   660 end;
   661 end;