# HG changeset patch # User koda # Date 1277895333 -7200 # Node ID aeca3d8f1b298c0ee0abb2cf7d09939a7cc4a115 # Parent ae50f63e4fa934fe284efe616d58d5e3cddd001a turn cReducedQuality into a LongInt and provide a series of quality flags (and best of all, this is still compatible with current frontend) diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/GSHandlers.inc Wed Jun 30 12:55:33 2010 +0200 @@ -137,7 +137,7 @@ PlaySound(sndSplash) end; - if not cReducedQuality and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius) then + if ((cReducedQuality and rqPlainSplash) = 0) and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius) then begin AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash); diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/hwengine.pas Wed Jun 30 12:55:33 2010 +0200 @@ -250,7 +250,7 @@ cVSyncInUse:= true; cTimerInterval:= 8; PathPrefix:= 'Data'; - cReducedQuality:= false; + cReducedQuality:= 0; //FIXME cShowFPS:= true; cInitVolume:= 100; @@ -501,7 +501,11 @@ cAltDamage:= ParamStr(15) = '1'; UserNick:= DecodeBase64(ParamStr(16)); isMusicEnabled:= ParamStr(17) = '1'; - cReducedQuality:= ParamStr(18) = '1'; + + if (ParamStr(18) = '1') then //HACK + cReducedQuality:= $FFFFFFFF + else + val(ParamStr(18), cReducedQuality); end; 3: begin val(ParamStr(2), ipcPort); @@ -585,7 +589,10 @@ cAltDamage:= ParamStr(12) = '1'; cShowFPS:= ParamStr(13) = '1'; val(ParamStr(14), cTimerInterval); - cReducedQuality:= ParamStr(15) = '1'; + if (ParamStr(15) = '1') then //HACK + cReducedQuality:= $FFFFFFFF + else + val(ParamStr(15), cReducedQuality); end else GameType:= gmtSyntax; end; diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uConsts.pas Wed Jun 30 12:55:33 2010 +0200 @@ -214,6 +214,18 @@ cBombsSpeed : hwFloat = (isNegative: false; QWordValue: 429496729); {$WARNINGS ON} + // reducedquality flags + rqNone = $00000000; // don't reduce quality + rqBlurryLand = $00000001; // downscaled terrain + rqLowRes = $00000002; // use half land array + rqNoBackground= $00000004; // don't draw background + rqSimpleRope = $00000008; // avoid drawing rope + rq2DWater = $00000010; // disabe 3D water effect + rqFancyBoom = $00000020; // no fancy explosion effects + rqKillFlakes = $00000040; // no flakes + rqSlowMenu = $00000080; // ammomenu appears with no animation + rqPlainSplash = $00000100; // no droplets + // image flags (for LoadImage()) ifNone = $00000000; // nothing special ifAlpha = $00000001; // use alpha channel (unused right now?) @@ -222,11 +234,11 @@ ifIgnoreCaps = $00000008; // ignore hardware capabilities when loading (i.e. image will not be drawn using OpenGL) // texture priority (allows OpenGL to keep frequently used textures in video memory more easily) - tpLowest = 0.00; + tpLowest = 0.00; tpLow = 0.25; tpMedium = 0.50; tpHigh = 0.75; - tpHighest = 1.00; + tpHighest = 1.00; {* REFERENCE 4096 -> $FFFFF000 diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uGears.pas Wed Jun 30 12:55:33 2010 +0200 @@ -1072,7 +1072,7 @@ end end; begin - if cReducedQuality then + if (cReducedQuality and rqSimpleRope) <> 0 then DrawRopeLinesRQ(Gear) else begin diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uMisc.pas Wed Jun 30 12:55:33 2010 +0200 @@ -84,7 +84,7 @@ cLandAdditions : Longword; cExplosives : Longword; cFullScreen : boolean; - cReducedQuality : boolean; + cReducedQuality : LongInt; cLocaleFName : shortstring; cSeed : shortstring; cInitVolume : LongInt; @@ -287,13 +287,14 @@ procedure SetTextureParameters(enableClamp: Boolean); begin -if enableClamp and not cReducedQuality then + //if enableClamp and not cReducedQuality then + if enableClamp and ((cReducedQuality and rqNoBackground) = 0) then begin - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) end; -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) end; function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; @@ -765,7 +766,7 @@ cLandAdditions := 4; cExplosives := 2; cFullScreen := false; - cReducedQuality := false; + cReducedQuality := 0; cLocaleFName := 'en.txt'; cSeed := ''; cInitVolume := 50; diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uStore.pas Wed Jun 30 12:55:33 2010 +0200 @@ -391,7 +391,7 @@ for ii:= Low(TSprite) to High(TSprite) do with SpritesData[ii] do // FIXME - add a sprite attribute - if (not cReducedQuality) or (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR, sprFlake, sprSplash, sprDroplet])) then // FIXME: hack + if ((cReducedQuality and rqNoBackground) = 0) or (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR, sprFlake, sprSplash, sprDroplet])) then // FIXME: hack begin if AltPath = ptNone then if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR] then // FIXME: hack @@ -424,7 +424,7 @@ else begin Texture:= Surface2Tex(tmpsurf, false); - if (ii = sprWater) and not cReducedQuality then // HACK: We should include some sprite attribute to define the texture wrap directions + if (ii = sprWater) and ((cReducedQuality and rq2DWater) = 0) then // HACK: We should include some sprite attribute to define the texture wrap directions begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); end; diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uVisualGears.pas Wed Jun 30 12:55:33 2010 +0200 @@ -131,7 +131,7 @@ exit end; -if cReducedQuality and +if ((cReducedQuality and rqFancyBoom) <> 0) and not (Kind in [vgtTeamHealthSorter, vgtSmallDamageTag, @@ -141,8 +141,8 @@ vgtSmokeTrace, vgtEvilTrace]) then begin - AddVisualGear:= nil; - exit + AddVisualGear:= nil; + exit end; New(gear); @@ -345,7 +345,7 @@ var Gear, t: PVisualGear; dmg: LongInt; begin -if (vobCount = 0) or (vobCount > 200) or cReducedQuality then exit; +if (vobCount = 0) or (vobCount > 200) or ((cReducedQuality and rqkillFlakes) <> 0) then exit; t:= VisualGearsList; while t <> nil do begin @@ -391,7 +391,7 @@ vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State); vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State); end; - if not cReducedQuality then + if (cReducedQuality and rqFancyBoom) = 0 then case Gear^.Kind of vgtSmoke: DrawSprite(sprSmoke, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); @@ -414,7 +414,7 @@ DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); end; end; - if not cReducedQuality then + if (cReducedQuality and rqFancyBoom) = 0 then case Gear^.Kind of vgtExplPart: DrawSprite(sprExplPart, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame); vgtExplPart2: DrawSprite(sprExplPart2, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame); diff -r ae50f63e4fa9 -r aeca3d8f1b29 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Tue Jun 29 23:30:49 2010 -0400 +++ b/hedgewars/uWorld.pas Wed Jun 30 12:55:33 2010 +0200 @@ -194,7 +194,7 @@ begin FollowGear:= nil; if AMxShift = AMWidth then prevPoint.X:= 0; - if cReducedQuality then + if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= 0 else if AMxShift > MENUSPEED then @@ -210,7 +210,7 @@ prevPoint:= CursorPoint; SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y) end; - if cReducedQuality then + if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= AMWidth else if AMxShift < (AMWidth - MENUSPEED) then @@ -563,33 +563,35 @@ //glPushMatrix; //glScalef(1.0, 1.0, 1.0); -if not isPaused then MoveCamera; + if not isPaused then + MoveCamera; -if not cReducedQuality then +{if not cReducedQuality then} + if (cReducedQuality and (rqNoBackground or rqKillFlakes or rq2DWater)) = 0 then begin - // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway - ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); - offsetY:= 10 * min(0, -145 - ScreenBottom); - SkyOffset:= offsetY div 35 + cWaveHeight; - HorizontOffset:= SkyOffset; - if ScreenBottom > SkyOffset then - HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); + // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway + ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); + offsetY:= 10 * min(0, -145 - ScreenBottom); + SkyOffset:= offsetY div 35 + cWaveHeight; + HorizontOffset:= SkyOffset; + if ScreenBottom > SkyOffset then + HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); - // background - DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); - DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); + // background + DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset); + DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); - DrawVisualGears(0); - - // Waves - DrawWater(255, SkyOffset); - 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); + DrawVisualGears(0); + + // Waves + DrawWater(255, SkyOffset); + 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); + else + DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0); DrawLand(WorldDx, WorldDy); @@ -628,14 +630,14 @@ // Waves DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); -if not cReducedQuality then + if (cReducedQuality and rq2DWater) = 0 then begin - //DrawWater(cWaterOpacity, - offsetY div 40); - 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, 2); - DrawWater(cWaterOpacity, - offsetY div 10); - DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); + //DrawWater(cWaterOpacity, - offsetY div 40); + 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, 2); + DrawWater(cWaterOpacity, - offsetY div 10); + DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); end else DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);