108 if PLongwordArray(texsurf^.pixels)^[i] = AMask then PLongwordArray(texsurf^.pixels)^[i]:= (RMask or GMask or BMask) and Color; |
108 if PLongwordArray(texsurf^.pixels)^[i] = AMask then PLongwordArray(texsurf^.pixels)^[i]:= (RMask or GMask or BMask) and Color; |
109 |
109 |
110 if SDL_MustLock(texsurf) then |
110 if SDL_MustLock(texsurf) then |
111 SDL_UnlockSurface(texsurf); |
111 SDL_UnlockSurface(texsurf); |
112 |
112 |
113 if CrosshairTex <> nil then FreeTexture(CrosshairTex); |
113 FreeTexture(CrosshairTex); |
114 CrosshairTex:= Surface2Tex(texsurf, false); |
114 CrosshairTex:= Surface2Tex(texsurf, false); |
115 SDL_FreeSurface(texsurf) |
115 SDL_FreeSurface(texsurf) |
116 end; |
116 end; |
117 |
117 |
118 SDL_FreeSurface(tmpsurf) |
118 SDL_FreeSurface(tmpsurf) |
374 AddProgress; |
374 AddProgress; |
375 |
375 |
376 // name of weapons in ammo menu |
376 // name of weapons in ammo menu |
377 for ai:= Low(TAmmoType) to High(TAmmoType) do |
377 for ai:= Low(TAmmoType) to High(TAmmoType) do |
378 with Ammoz[ai] do |
378 with Ammoz[ai] do |
379 begin |
379 begin |
380 TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true); |
380 TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true); |
381 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels); |
381 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels); |
382 TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true); |
382 TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true); |
383 tmpsurf:= doSurfaceConversion(tmpsurf); |
383 tmpsurf:= doSurfaceConversion(tmpsurf); |
384 if (NameTex <> nil) then |
384 FreeTexture(NameTex); |
385 FreeTexture(NameTex); |
|
386 NameTex:= Surface2Tex(tmpsurf, false); |
385 NameTex:= Surface2Tex(tmpsurf, false); |
387 SDL_FreeSurface(tmpsurf) |
386 SDL_FreeSurface(tmpsurf) |
388 end; |
387 end; |
389 |
388 |
390 // number of weapons in ammo menu |
389 // number of weapons in ammo menu |
391 for i:= Low(CountTexz) to High(CountTexz) do |
390 for i:= Low(CountTexz) to High(CountTexz) do |
392 begin |
391 begin |
393 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); |
392 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); |
394 tmpsurf:= doSurfaceConversion(tmpsurf); |
393 tmpsurf:= doSurfaceConversion(tmpsurf); |
395 if (CountTexz[i] <> nil) then |
394 FreeTexture(CountTexz[i]); |
396 FreeTexture(CountTexz[i]); |
|
397 CountTexz[i]:= Surface2Tex(tmpsurf, false); |
395 CountTexz[i]:= Surface2Tex(tmpsurf, false); |
398 SDL_FreeSurface(tmpsurf) |
396 SDL_FreeSurface(tmpsurf) |
399 end; |
397 end; |
400 |
398 |
401 AddProgress; |
399 AddProgress; |
442 CountTexz[i]:= nil |
440 CountTexz[i]:= nil |
443 end; |
441 end; |
444 |
442 |
445 // free all team and hedgehog textures |
443 // free all team and hedgehog textures |
446 for t:= 0 to Pred(TeamsCount) do |
444 for t:= 0 to Pred(TeamsCount) do |
447 begin |
445 begin |
448 if TeamsArray[t] <> nil then |
446 if TeamsArray[t] <> nil then |
449 begin |
447 begin |
450 FreeTexture(TeamsArray[t]^.NameTagTex); |
448 FreeTexture(TeamsArray[t]^.NameTagTex); |
451 TeamsArray[t]^.NameTagTex:= nil; |
449 TeamsArray[t]^.NameTagTex:= nil; |
452 FreeTexture(TeamsArray[t]^.CrosshairTex); |
450 FreeTexture(TeamsArray[t]^.CrosshairTex); |
453 TeamsArray[t]^.CrosshairTex:= nil; |
451 TeamsArray[t]^.CrosshairTex:= nil; |
454 FreeTexture(TeamsArray[t]^.GraveTex); |
452 FreeTexture(TeamsArray[t]^.GraveTex); |
458 FreeTexture(TeamsArray[t]^.AIKillsTex); |
456 FreeTexture(TeamsArray[t]^.AIKillsTex); |
459 TeamsArray[t]^.AIKillsTex:= nil; |
457 TeamsArray[t]^.AIKillsTex:= nil; |
460 FreeTexture(TeamsArray[t]^.FlagTex); |
458 FreeTexture(TeamsArray[t]^.FlagTex); |
461 TeamsArray[t]^.FlagTex:= nil; |
459 TeamsArray[t]^.FlagTex:= nil; |
462 for i:= 0 to cMaxHHIndex do |
460 for i:= 0 to cMaxHHIndex do |
463 begin |
461 begin |
464 FreeTexture(TeamsArray[t]^.Hedgehogs[i].NameTagTex); |
462 FreeTexture(TeamsArray[t]^.Hedgehogs[i].NameTagTex); |
465 TeamsArray[t]^.Hedgehogs[i].NameTagTex:= nil; |
463 TeamsArray[t]^.Hedgehogs[i].NameTagTex:= nil; |
466 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HealthTagTex); |
464 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HealthTagTex); |
467 TeamsArray[t]^.Hedgehogs[i].HealthTagTex:= nil; |
465 TeamsArray[t]^.Hedgehogs[i].HealthTagTex:= nil; |
468 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HatTex); |
466 FreeTexture(TeamsArray[t]^.Hedgehogs[i].HatTex); |
469 TeamsArray[t]^.Hedgehogs[i].HatTex:= nil; |
467 TeamsArray[t]^.Hedgehogs[i].HatTex:= nil; |
|
468 end; |
470 end; |
469 end; |
471 end; |
470 end; |
472 end; |
|
473 {$IFNDEF S3D_DISABLED} |
471 {$IFNDEF S3D_DISABLED} |
474 if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then |
472 if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then |
475 begin |
473 begin |
476 glDeleteTextures(1, @texl); |
474 glDeleteTextures(1, @texl); |
477 glDeleteRenderbuffersEXT(1, @depthl); |
475 glDeleteRenderbuffersEXT(1, @depthl); |
478 glDeleteFramebuffersEXT(1, @framel); |
476 glDeleteFramebuffersEXT(1, @framel); |
479 glDeleteTextures(1, @texr); |
477 glDeleteTextures(1, @texr); |
480 glDeleteRenderbuffersEXT(1, @depthr); |
478 glDeleteRenderbuffersEXT(1, @depthr); |
481 glDeleteFramebuffersEXT(1, @framer) |
479 glDeleteFramebuffersEXT(1, @framer) |
482 end |
480 end |
483 {$ENDIF} |
481 {$ENDIF} |
484 end; |
482 end; |
485 |
483 |
486 |
484 |
487 procedure RenderHealth(var Hedgehog: THedgehog); |
485 procedure RenderHealth(var Hedgehog: THedgehog); |
488 var s: shortstring; |
486 var s: shortstring; |
489 begin |
487 begin |
490 str(Hedgehog.Gear^.Health, s); |
488 str(Hedgehog.Gear^.Health, s); |
491 if Hedgehog.HealthTagTex <> nil then |
489 FreeTexture(Hedgehog.HealthTagTex); |
492 FreeTexture(Hedgehog.HealthTagTex); |
|
493 Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16) |
490 Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16) |
494 end; |
491 end; |
495 |
492 |
496 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
493 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
497 var tmpsurf: PSDL_Surface; |
494 var tmpsurf: PSDL_Surface; |