# HG changeset patch # User smxx # Date 1272561670 0 # Node ID faee68a28b82aae368f2f7316f6d76e4e6ab09f2 # Parent 88bb88294e06beb061bd514d5463b7680a7495da Engine: * Did some OpenGL cleanup, avoiding additional calls to glColor, etc. diff -r 88bb88294e06 -r faee68a28b82 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Thu Apr 29 17:20:42 2010 +0000 +++ b/hedgewars/uChat.pas Thu Apr 29 17:21:10 2010 +0000 @@ -126,9 +126,9 @@ begin r.w:= InputStr.Width; DrawFillRect(r); - Tint(0, 0, 0, 0.5); + Tint($80000000); DrawTexture(9 - cScreenWidth div 2, visibleCount * 16 + 11, InputStr.Tex); - Tint(1, 1, 1, 1); + Tint($FFFFFFFF); DrawTexture(8 - cScreenWidth div 2, visibleCount * 16 + 10, InputStr.Tex); end; @@ -145,9 +145,9 @@ begin r.w:= Strs[i].Width; DrawFillRect(r); - Tint(0, 0, 0, 0.5); + Tint($80000000); DrawTexture(9 - cScreenWidth div 2, (visibleCount - t) * 16 - 5, Strs[i].Tex); - Tint(1, 1, 1, 1); + Tint($FFFFFFFF); DrawTexture(8 - cScreenWidth div 2, (visibleCount - t) * 16 - 6, Strs[i].Tex); dec(r.y, 16); diff -r 88bb88294e06 -r faee68a28b82 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Apr 29 17:20:42 2010 +0000 +++ b/hedgewars/uGears.pas Thu Apr 29 17:21:10 2010 +0000 @@ -962,9 +962,9 @@ if HH^.Effects[hePoisoned] then begin - glColor4f(0.25, 1, 0, 0.25); + Tint($4000FF40); DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); - glColor4f(1, 1, 1, 1) + Tint($FFFFFFFF) end; if ((Gear^.State and gstWinner) <> 0) and @@ -1047,7 +1047,7 @@ glLineWidth(1.0); - glColor4ub($FF, $00, $00, $C0); + Tint($C00000FF); VertexBuffer[0].X:= hx + WorldDx; VertexBuffer[0].Y:= hy + WorldDy; VertexBuffer[1].X:= tx + WorldDx; @@ -1056,7 +1056,7 @@ glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); glEnable(GL_TEXTURE_2D); glDisable(GL_LINE_SMOOTH); end; @@ -1454,7 +1454,7 @@ begin t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; if (cTagsMask and htTransparent) <> 0 then - glColor4f(1, 1, 1, 0.5); + Tint($80FFFFFF); if ((cTagsMask and htHealth) <> 0) then begin dec(t, HealthTagTex^.h + 2); @@ -1471,7 +1471,7 @@ DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) end; if (cTagsMask and htTransparent) <> 0 then - glColor4f(1, 1, 1, 1) + Tint($FFFFFFFF) end; if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog begin @@ -1487,25 +1487,23 @@ if HH^.Effects[hePoisoned] then begin - glColor4f(0.25, 1, 0, 0.5); + Tint($8000FF40); DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360); - glColor4f(1, 1, 1, 1) end; if Gear^.Invulnerable then begin - glColor4f(1, 1, 1, 0.25 + abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)); + Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - 2 * ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); - glColor4f(1, 1, 1, 1); end; if cVampiric and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear = Gear) then begin - glColor4f(1, 1, 1, 0.25 + abs(1 - (RealTicks mod 1500) / 750)); + Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - (RealTicks mod 1500) / 750)))); DrawSprite(sprVampiric, sx - 24, sy - 24, 0); - glColor4f(1, 1, 1, 1); end; + Tint($FFFFFFFF) end; procedure DrawRopeLinesRQ(Gear: PGear); @@ -1529,12 +1527,12 @@ glLineWidth(4.0); - glColor4f(0.8, 0.8, 0.8, 1); + Tint($FFC0C0C0); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]); glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); glPopMatrix; @@ -1733,9 +1731,9 @@ end; gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); gtTarget: begin - glColor4f(1, 1, 1, Gear^.Timer / 1000); + Tint($FF, $FF, $FF, floor($FF * Gear^.Timer / 1000)); DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtCake: if Gear^.Pos = 6 then @@ -1777,18 +1775,18 @@ DrawTextureF(SpritesData[sprBirdy].Texture, 1, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); end; gtBigExplosion: begin - glColor4f(1, 1, 1, -1.0 * (power(Gear^.Timer/250, 4) - 1)); + Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4)))); DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 16, 16, Gear^.DirAngle); gtPiano: begin if (Gear^.State and gstDrowning) = 0 then begin - glColor4f(1, 1, 1, 0.0625); + Tint($10FFFFFF); for i:= 8 downto 1 do DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0); - glColor4f(1, 1, 1, 1) + Tint($FFFFFFFF) end; DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 128, 128, 0); end; diff -r 88bb88294e06 -r faee68a28b82 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Apr 29 17:20:42 2010 +0000 +++ b/hedgewars/uStore.pas Thu Apr 29 17:21:10 2010 +0000 @@ -75,7 +75,8 @@ procedure RenderWeaponTooltip(atype: TAmmoType); procedure ShowWeaponTooltip(x, y: LongInt); procedure FreeWeaponTooltip; -procedure Tint(r, g, b, a: Single); +procedure Tint(r, g, b, a: Byte); inline; +procedure Tint(c: Longword); inline; implementation uses uMisc, uConsole, uLand, uLocale, uWorld{$IFDEF IPHONEOS}, PascalExports{$ENDIF}; @@ -85,11 +86,40 @@ var HHTexture: PTexture; MaxTextureSize: LongInt; cGPUVendor: TGPUVendor; + lastTint: Longword; -procedure Tint(r, g, b, a: Single); +{$IFNDEF IPHONEOS} +procedure Tint(r, g, b, a: Byte); inline; +begin +Tint((a shl 24) or (b shl 16) or (g shl 8) or r); +end; + +procedure Tint(c: Longword); inline; begin -glColor4f(r, g, b, a); +if c = lastTint then + exit; +glColor4ubv(@c); +lastTint:= c; end; +{$ELSE} +procedure Tint(r, g, b, a: Byte); inline; +var nc: Longword; +begin +nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; +if nc = lastTint then + exit; +glColor4ub(r, g, b, a); +lastTint:= nc; +end; + +procedure Tint(c: Longword); inline; +begin +if c = lastTint then + exit; +Tint(c and $FF, (c shr 8) and $FF, (c shr 16) and $FF, (c shr 24) and $FF); +lastTint:= c; +end; +{$ENDIF} procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); var r: TSDL_Rect; @@ -543,7 +573,8 @@ glTranslatef(Dir*OffsetX, OffsetY, 0); glScalef(Scale, Scale, 1); -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +// Any reason for this call? And why only in t direction, not s? +//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); if Dir < 0 then hw:= w div -2 @@ -758,9 +789,6 @@ glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); - -glColor4f(1,1,1,1); - glPopMatrix end; @@ -769,7 +797,7 @@ begin glDisable(GL_TEXTURE_2D); -glColor4ub(0, 0, 0, 127); +Tint($80000000); VertexBuffer[0].X:= r.x; VertexBuffer[0].Y:= r.y; @@ -785,7 +813,7 @@ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); glDisableClientState(GL_VERTEX_ARRAY); -glColor4f(1, 1, 1, 1); +Tint($FFFFFFFF); glEnable(GL_TEXTURE_2D) end; @@ -1125,19 +1153,18 @@ var vendor: shortstring; begin {$IFDEF IPHONEOS} -//these are good performance savers, perhaps we could enable them by default - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); +{$ELSE} + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); +{$ENDIF} + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); // no depth buffer SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); - SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); - //SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); -{$ELSE} - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -{$ENDIF} + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); // no alpha channel required + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer has to be 16 bit only + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // try to prefer hardware rendering {$IFNDEF SDL13} // this attribute is default in 1.3 and must be enabled in MacOSX @@ -1204,6 +1231,12 @@ // enable alpha blending glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + // disable/lower perspective correction (won't need it anyway) + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + // disable dithering + glDisable(GL_DITHER); + // enable 2d textures by default + glEnable(GL_TEXTURE_2D); end; procedure SetScale(f: GLfloat); @@ -1217,9 +1250,10 @@ // leave immediately if scale factor did not change if f = cScaleFactor then exit; - if f = scale then glPopMatrix // "return" to default scaling + if f = scale then + glPopMatrix // "return" to default scaling else // other scaling - begin + begin glPushMatrix; // save default scaling glLoadIdentity; {$IFDEF IPHONEOS} @@ -1227,7 +1261,7 @@ {$ENDIF} glScalef(f / cScreenWidth, -f / cScreenHeight, 1.0); glTranslatef(0, -cScreenHeight / 2, 0); - end; + end; cScaleFactor:= f; end; @@ -1252,7 +1286,6 @@ TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); glClear(GL_COLOR_BUFFER_BIT); - glEnable(GL_TEXTURE_2D); if Step < numsquares then r.x:= 0 else r.x:= squaresize; @@ -1262,7 +1295,6 @@ DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); - glDisable(GL_TEXTURE_2D); SDL_GL_SwapBuffers(); {$IFDEF SDL13} SDL_RenderPresent(); diff -r 88bb88294e06 -r faee68a28b82 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Thu Apr 29 17:20:42 2010 +0000 +++ b/hedgewars/uVisualGears.pas Thu Apr 29 17:21:10 2010 +0000 @@ -335,7 +335,8 @@ else begin Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; - Gear^.alpha := -1.0 * (power(Gear^.Timer/350, 4) - 1); + Gear^.alpha := 1 - power(Gear^.Timer / 350, 4); + if Gear^.alpha < 0 then Gear^.alpha:= 0; end; end; @@ -755,11 +756,11 @@ vgtSmokeWhite: DrawSprite(sprSmokeWhite, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtDust: DrawSprite(sprDust, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtFeather: begin - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, Gear^.FrameTicks / 250); + if Gear^.FrameTicks < 255 then + Tint($FF, $FF, $FF, Gear^.FrameTicks); DrawRotatedF(sprFeather, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, 1); + if Gear^.FrameTicks < 255 then + Tint($FFFFFFFF); end; end; Gear:= Gear^.NextGear @@ -774,47 +775,47 @@ vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8); vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame); vgtAmmo: begin - glColor4f(1, 1, 1, Gear^.alpha); + Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32); DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; vgtHealth: begin case Gear^.Frame div 10 of - 0:glColor4f(0, 1, 0, Gear^.FrameTicks / 1000); - 1:glColor4f(1, 0, 0, Gear^.FrameTicks / 1000); + 0:Tint(0, $FF, 0, floor(Gear^.FrameTicks * $FF / 1000)); + 1:Tint($FF, 0, 0, floor(Gear^.FrameTicks * $FF / 1000)); end; DrawSprite(sprHealth, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, 0); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; vgtShell: begin - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, Gear^.FrameTicks / 250); + if Gear^.FrameTicks < $FF then + Tint($FF, $FF, $FF, Gear^.FrameTicks); DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, 1); + if Gear^.FrameTicks < $FF then + Tint($FFFFFFFF); end; vgtEgg: begin - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, Gear^.FrameTicks / 250); + if Gear^.FrameTicks < $FF then + Tint($FF, $FF, $FF, Gear^.FrameTicks); DrawRotatedF(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, 1); + if Gear^.FrameTicks < $FF then + Tint($FFFFFFFF); end; vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 40, hwRound(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37)); vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame); vgtBeeTrace: begin - if Gear^.FrameTicks < 250 then - glColor4f(1, 1, 1, Gear^.FrameTicks / 500) + if Gear^.FrameTicks < $FF then + Tint($FF, $FF, $FF, Gear^.FrameTicks div 2) else - glColor4f(1, 1, 1, 0.5); + Tint($80FFFFFF); DrawRotatedF(sprBeeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; vgtSmokeRing: begin - glColor4f(1, 1, 1, Gear^.alpha); + Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle); - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); end; end; case Gear^.Kind of diff -r 88bb88294e06 -r faee68a28b82 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Apr 29 17:20:42 2010 +0000 +++ b/hedgewars/uWorld.pas Thu Apr 29 17:21:10 2010 +0000 @@ -331,23 +331,23 @@ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - glColor4f(1, 1, 1, 1); // disable coloring + glColor4ub($FF, $FF, $FF, $FF); // disable coloring glEnable(GL_TEXTURE_2D) end end; -procedure DrawWaves(Dir, dX, dY: LongInt; Tint: GLfloat); +procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; lw, waves, shift: GLfloat; begin lw:= cScreenWidth / cScaleFactor; waves:= lw * 2 / cWaveWidth; -glColor4f( - (Tint * WaterColorArray[2].r / 255) + (1-Tint) - , (Tint * WaterColorArray[2].g / 255) + (1-Tint) - , (Tint * WaterColorArray[2].b / 255) + (1-Tint) - , 1 +Tint( + (tnt * WaterColorArray[2].r div 255) + (255-tnt) + , (tnt * WaterColorArray[2].g div 255) + (255-tnt) + , (tnt * WaterColorArray[2].b div 255) + (255-tnt) + , 255 ); glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id); @@ -380,8 +380,7 @@ glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); -glColor4f(1, 1, 1, 1); - +Tint($FFFFFFFF); {for i:= -1 to cWaterSprCount do DrawSprite(sprWater, @@ -453,8 +452,6 @@ // Sky glClear(GL_COLOR_BUFFER_BIT); -glEnable(GL_BLEND); -glEnable(GL_TEXTURE_2D); //glPushMatrix; //glScalef(1.0, 1.0, 1.0); @@ -478,10 +475,10 @@ // Waves DrawWater(255, SkyOffset); - DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 0.25); - DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 0.19); - DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 0.14); - DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 0.09); + DrawWaves( 1, 0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64); + DrawWaves( -1, 25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48); + DrawWaves( 1, 75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32); + DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24); end else DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); @@ -521,14 +518,14 @@ DrawWater(cWaterOpacity, 0); // Waves -DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 0.05); +DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); if not cReducedQuality then begin //DrawWater(cWaterOpacity, - offsetY div 40); - DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 0.03); + DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); DrawWater(cWaterOpacity, - offsetY div 20); - DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 0.01); + DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); DrawWater(cWaterOpacity, - offsetY div 10); DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); end @@ -655,7 +652,7 @@ highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); if highlight then - glColor4f(((Clan^.Color shr 16) and $ff) / $ff, ((Clan^.Color shr 8) and $ff) / $ff, (Clan^.Color and $ff) / $ff, 1); + Tint(Clan^.Color); // draw name DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); @@ -678,7 +675,7 @@ // this approach should be faster than drawing all borders one by one tinted or not if highlight then begin - glColor4f(1, 1, 1, 1); + Tint($FFFFFFFF); // draw name r.x:= 2; @@ -813,8 +810,6 @@ if GameState = gsConfirm then DrawCentered(0, (cScreenHeight shr 1), ConfirmTexture); -glDisable(GL_TEXTURE_2D); - if ScreenFade <> sfNone then begin if not isFirstFrame then @@ -831,11 +826,10 @@ if ScreenFade <> sfNone then begin case ScreenFade of - sfToBlack, sfFromBlack: glColor4f(0, 0, 0, ScreenFadeValue / 1000); - sfToWhite, sfFromWhite: glColor4f(1, 1, 1, ScreenFadeValue / 1000); + sfToBlack, sfFromBlack: Tint(0, 0, 0, ScreenFadeValue * 255 div 1000); + sfToWhite, sfFromWhite: Tint($FF, $FF, $FF, ScreenFadeValue * 255 div 1000); end; - glDisable(GL_TEXTURE_2D); VertexBuffer[0].X:= -cScreenWidth; VertexBuffer[0].Y:= cScreenHeight; VertexBuffer[1].X:= -cScreenWidth; @@ -845,18 +839,18 @@ VertexBuffer[3].X:= cScreenWidth; VertexBuffer[3].Y:= cScreenHeight; + glDisable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); glDisableClientState(GL_VERTEX_ARRAY); - - glColor4f(1, 1, 1, 1); + glEnable(GL_TEXTURE_2D); + Tint($FFFFFFFF); if not isFirstFrame and ((ScreenFadeValue = 0) or (ScreenFadeValue = sfMax)) then ScreenFade:= sfNone end end; SetScale(zoom); -glEnable(GL_TEXTURE_2D); // Cursor if isCursorVisible then @@ -874,9 +868,6 @@ DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) end end; - -glDisable(GL_TEXTURE_2D); -glDisable(GL_BLEND); isFirstFrame:= false end;