cWeaponTooltips -> rqTooltipsOff
authorkoda
Sat, 10 Jul 2010 15:39:07 +0200
changeset 3634 93d260c96635
parent 3632 8e1bd8b5780e
child 3635 38d3e31556d3
cWeaponTooltips -> rqTooltipsOff
hedgewars/hwengine.pas
hedgewars/uConsts.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Info.plist
--- a/hedgewars/hwengine.pas	Sat Jul 10 02:02:37 2010 +0200
+++ b/hedgewars/hwengine.pas	Sat Jul 10 15:39:07 2010 +0200
@@ -231,13 +231,7 @@
     val(gameArgs[7], cScreenWidth);
     recordFileName:= gameArgs[8];
     
-    val(gameArgs[9], tmp_quality);
-    case tmp_quality of
-        0: cReducedQuality:= rqNone;
-        1: cReducedQuality:= rqBlurryLand;
-        2: cReducedQuality:= rqBlurryLand or rqKillFlakes;
-        3: cReducedQuality:= rqBlurryLand or rqKillFlakes or rqLowRes;
-    end;
+    val(gameArgs[9], cReducedQuality);
 {$ENDIF}
 
     initEverything(true);
@@ -454,7 +448,7 @@
             cFullScreen:= ParamStr(6) = '1';
             isSoundEnabled:= ParamStr(7) = '1';
             cVSyncInUse:= ParamStr(8) = '1';        //unused
-            cWeaponTooltips:= ParamStr(9) = '1';    //should be merged with rqFlags
+            //cWeaponTooltips:= ParamStr(9) = '1';  //merged with rqFlags
             cLocaleFName:= ParamStr(10);
             val(ParamStr(11), cInitVolume);
             val(ParamStr(12), cTimerInterval);
@@ -464,10 +458,13 @@
             UserNick:= DecodeBase64(ParamStr(16));
             isMusicEnabled:= ParamStr(17) = '1';
 
-            if (ParamStr(18) = '1') then        //HACK
+            if (ParamStr(18) = '1') then        //HACK - always disable rqLowRes as it's a game breaker
                 cReducedQuality:= $FFFFFFFF xor rqLowRes
             else
                 val(ParamStr(18), cReducedQuality);
+                
+            if (ParamStr(9) = '0') then         //HACK - if cWeaponTooltips not true, disable it
+                cReducedQuality:= cReducedQuality xor rqTooltipsOff;
         end;
         3: begin
             val(ParamStr(2), ipcPort);
--- a/hedgewars/uConsts.pas	Sat Jul 10 02:02:37 2010 +0200
+++ b/hedgewars/uConsts.pas	Sat Jul 10 15:39:07 2010 +0200
@@ -215,8 +215,8 @@
 
     // reducedquality flags
     rqNone        = $00000000;  // don't reduce quality
-    rqBlurryLand  = $00000001;  // downscaled terrain
-    rqLowRes      = $00000002;  // use half land array
+    rqLowRes      = $00000001;  // use half land array
+    rqBlurryLand  = $00000002;  // downscaled terrain
     rqNoBackground= $00000004;  // don't draw background
     rqSimpleRope  = $00000008;  // avoid drawing rope
     rq2DWater     = $00000010;  // disabe 3D water effect
@@ -225,6 +225,7 @@
     rqSlowMenu    = $00000080;  // ammomenu appears with no animation
     rqPlainSplash = $00000100;  // no droplets
     rqClampLess   = $00000200;  // don't clamp textures
+    rqTooltipsOff = $00000400;  // tooltips are not drawn
 
     // image flags (for LoadImage())
     ifNone        = $00000000;  // nothing special
--- a/hedgewars/uMisc.pas	Sat Jul 10 02:02:37 2010 +0200
+++ b/hedgewars/uMisc.pas	Sat Jul 10 15:39:07 2010 +0200
@@ -81,7 +81,6 @@
     isSoundEnabled  : boolean = true;
     isMusicEnabled  : boolean = false;
     cVSyncInUse     : boolean = true;    
-    cWeaponTooltips : boolean = true;
     cLocaleFName    : shortstring = 'en.txt';
     cInitVolume     : LongInt = 50;
     cTimerInterval  : LongInt = 8;
--- a/hedgewars/uStore.pas	Sat Jul 10 02:02:37 2010 +0200
+++ b/hedgewars/uStore.pas	Sat Jul 10 15:39:07 2010 +0200
@@ -1511,11 +1511,11 @@
     extra: ansistring;
     extracolor: LongInt;
 begin
-// don't do anything if the window shouldn't be shown
-if not cWeaponTooltips then
+    // don't do anything if the window shouldn't be shown
+    if (cReducedQuality and rqTooltipsOff) <> 0 then
     begin
-    WeaponTooltipTex:= nil;
-    exit
+        WeaponTooltipTex:= nil;
+        exit
     end;
 
 // free old texture
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Sat Jul 10 02:02:37 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Sat Jul 10 15:39:07 2010 +0200
@@ -367,7 +367,8 @@
     NSString *wSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.width];
     NSString *hSize = [[NSString alloc] initWithFormat:@"%d", (int) screenBounds.size.height];
     const char **gameArgs = (const char**) malloc(sizeof(char *) * 10);
-
+    NSInteger tmpQuality;
+    
     size_t size;
     // Set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space
     sysctlbyname("hw.machine", NULL, &size, NULL, 0); 
@@ -379,17 +380,20 @@
 
     if ([modelId hasPrefix:@"iPhone1"] ||                                   // = iPhone or iPhone 3G
         [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"])   // = iPod Touch or iPod Touch 2G
-        gameArgs[9] = "3";                          // rqLowRes & rqBlurryLand & rqKillFlakes
+        tmpQuality = 0x00000001 | 0x00000002 | 0x00000040;  // rqLowRes | rqBlurryLand | rqKillFlakes
     else if ([modelId hasPrefix:@"iPhone2"] ||                              // = iPhone 3GS
              [modelId hasPrefix:@"iPod3"])                                  // = iPod Touch 3G
-            gameArgs[9] = "2";                      // rqBlurryLand & rqKillFlakes
+            tmpQuality = 0x00000002 | 0x00000040;           // rqBlurryLand | rqKillFlakes 
         else if ([modelId hasPrefix:@"iPad1"])                              // = iPad
-                gameArgs[9] = "1";                  // rqBlurryLand
+                tmpQuality = 0x00000002;                    // rqBlurryLand
             else                                                            // = everything else
-                gameArgs[9] = "0";                  // full quality
+                tmpQuality = 0;                             // full quality
+    if (![modelId hasPrefix:@"iPad"])                                       // = disable tooltips unless iPad
+        tmpQuality = tmpQuality | 0x00000400;
     [modelId release];
     
-    
+    gameArgs[9] = [[[NSNumber numberWithInteger:tmpQuality] stringValue] UTF8String];
+
     // prevents using an empty nickname
     NSString *username;
     NSString *originalUsername = [self.systemSettings objectForKey:@"username"];
--- a/project_files/HedgewarsMobile/Info.plist	Sat Jul 10 02:02:37 2010 +0200
+++ b/project_files/HedgewarsMobile/Info.plist	Sat Jul 10 15:39:07 2010 +0200
@@ -42,5 +42,7 @@
 	<string>LI-ipad</string>
 	<key>UILaunchImageFile~iphone</key>
 	<string>LI-iphone</string>
+	<key>UIApplicationExitsOnSuspend</key>
+	<true/>
 </dict>
 </plist>