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; |