hedgewars/uStore.pas
changeset 4925 3d90fd7f738a
parent 4920 bc3c077e15a2
child 4933 86bd82d58a0b
equal deleted inserted replaced
4924:616b618814b5 4925:3d90fd7f738a
   341     begin
   341     begin
   342         TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
   342         TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
   343         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
   343         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
   344         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
   344         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
   345         tmpsurf:= doSurfaceConversion(tmpsurf);
   345         tmpsurf:= doSurfaceConversion(tmpsurf);
   346         // these two lines lines crash when run multiple times?
   346         if (NameTex <> nil) then
   347         //if (NameTex <> nil) then
   347             FreeTexture(NameTex);
   348         //    FreeTexture(NameTex);
       
   349         NameTex:= Surface2Tex(tmpsurf, false);
   348         NameTex:= Surface2Tex(tmpsurf, false);
   350         SDL_FreeSurface(tmpsurf)
   349         SDL_FreeSurface(tmpsurf)
   351     end;
   350     end;
   352 
   351 
   353 // number of weapons in ammo menu
   352 // number of weapons in ammo menu
   354 for i:= Low(CountTexz) to High(CountTexz) do
   353 for i:= Low(CountTexz) to High(CountTexz) do
   355 begin
   354 begin
   356     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   355     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   357     tmpsurf:= doSurfaceConversion(tmpsurf);
   356     tmpsurf:= doSurfaceConversion(tmpsurf);
   358     // these two lines lines crash when run multiple times?
   357     if (CountTexz[i] <> nil) then
   359     //if (CountTexz[i] <> nil) then
   358         FreeTexture(CountTexz[i]);
   360     //    FreeTexture(CountTexz[i]);
       
   361     CountTexz[i]:= Surface2Tex(tmpsurf, false);
   359     CountTexz[i]:= Surface2Tex(tmpsurf, false);
   362     SDL_FreeSurface(tmpsurf)
   360     SDL_FreeSurface(tmpsurf)
   363 end;
   361 end;
   364 
   362 
   365 AddProgress;
   363 AddProgress;
   949     AddFileLog('Setting up OpenGL (using driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))) + ')');
   947     AddFileLog('Setting up OpenGL (using driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))) + ')');
   950     SetupOpenGL();
   948     SetupOpenGL();
   951 end;
   949 end;
   952 
   950 
   953 procedure initModule;
   951 procedure initModule;
       
   952 var ai: TAmmoType;
       
   953     i: LongInt;
   954 begin
   954 begin
   955     RegisterVariable('fullscr', vtCommand, @chFullScr, true);
   955     RegisterVariable('fullscr', vtCommand, @chFullScr, true);
   956 
   956 
   957     PixelFormat:= nil;
   957     PixelFormat:= nil;
   958     SDLPrimSurface:= nil;
   958     SDLPrimSurface:= nil;
   964 
   964 
   965     cScaleFactor:= 2.0;
   965     cScaleFactor:= 2.0;
   966     SupportNPOTT:= false;
   966     SupportNPOTT:= false;
   967     Step:= 0;
   967     Step:= 0;
   968     ProgrTex:= nil;
   968     ProgrTex:= nil;
       
   969 
       
   970     // init all ammo name texture pointers
       
   971     for ai:= Low(TAmmoType) to High(TAmmoType) do
       
   972     begin
       
   973         Ammoz[ai].NameTex := nil;
       
   974     end;
       
   975     // init all count texture pointers
       
   976     for i:= Low(CountTexz) to High(CountTexz) do
       
   977     begin
       
   978         CountTexz[i] := nil;
       
   979     end;
   969 end;
   980 end;
   970 
   981 
   971 procedure freeModule;
   982 procedure freeModule;
   972 begin
   983 begin
   973 end;
   984 end;