# HG changeset patch # User koda # Date 1278780208 -7200 # Node ID c0d82112f479d4f611d5e2bdb57ce087e3eb5513 # Parent 38d3e31556d3c5f47e6f2630e2a6b11e15177b33# Parent 130c24d7404349bb7410a5f7186ebf0530f18557 merge diff -r 130c24d74043 -r c0d82112f479 hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Fri Jul 09 20:09:46 2010 -0400 +++ b/hedgewars/PascalExports.pas Sat Jul 10 18:43:28 2010 +0200 @@ -20,6 +20,8 @@ implementation {$IFDEF HWLIBRARY} +var xx, yy: LongInt; + // retrieve protocol information procedure HW_versionInfo(netProto: PShortInt; versionStr: Ppchar); cdecl; export; begin @@ -174,6 +176,18 @@ CursorPoint.Y:= y; end; +procedure HW_saveCursor(reset: boolean); cdecl; export; +begin + if reset then + begin + CursorPoint.X:= xx; + CursorPoint.Y:= yy; + end + else + xx:= CursorPoint.X; + yy:= CursorPoint.Y; +end; + function HW_isAmmoOpen:boolean; cdecl; export; begin exit(bShowAmmoMenu); diff -r 130c24d74043 -r c0d82112f479 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Jul 09 20:09:46 2010 -0400 +++ b/hedgewars/hwengine.pas Sat Jul 10 18:43:28 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); diff -r 130c24d74043 -r c0d82112f479 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Fri Jul 09 20:09:46 2010 -0400 +++ b/hedgewars/uConsts.pas Sat Jul 10 18:43:28 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 diff -r 130c24d74043 -r c0d82112f479 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Fri Jul 09 20:09:46 2010 -0400 +++ b/hedgewars/uMisc.pas Sat Jul 10 18:43:28 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; diff -r 130c24d74043 -r c0d82112f479 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Jul 09 20:09:46 2010 -0400 +++ b/hedgewars/uStore.pas Sat Jul 10 18:43:28 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 diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sat Jul 10 18:43:28 2010 +0200 @@ -162,6 +162,7 @@ } else { DLog(@"gameconfig data not complete!!\nmapConfigViewController = %@\nteamConfigViewController = %@\nschemeWeaponConfigViewController = %@\n", mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController); + [self.parentViewController dismissModalViewControllerAnimated:YES]; } } diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Classes/GameSetup.m --- a/project_files/HedgewarsMobile/Classes/GameSetup.m Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Sat Jul 10 18:43:28 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"]; diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Sat Jul 10 18:43:28 2010 +0200 @@ -19,7 +19,10 @@ PopoverMenuViewController *popupMenu; BOOL isPopoverVisible; + // touch section + BOOL isSingleClick; CGFloat initialDistanceForPinching; + CGPoint pointWhereToClick; } @property (nonatomic,retain) id popoverController; diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Jul 10 18:43:28 2010 +0200 @@ -355,8 +355,13 @@ if (currentPosition.y < screen.size.width - 130 || (currentPosition.x > 130 && currentPosition.x < screen.size.height - 130)) { switch ([touches count]) { case 1: - DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y)); - HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); + //DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y)); + // this is a single touch/tap + isSingleClick = YES; + // save were the click event will take place + pointWhereToClick = currentPosition; + + [[self.view viewWithTag:5599] removeFromSuperview]; if (2 == [touch tapCount]) HW_zoomReset(); break; @@ -374,9 +379,40 @@ } -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - initialDistanceForPinching = 0; + CGRect screen = [[UIScreen mainScreen] bounds]; //HW_allKeysUp(); - HW_click(); + if (HW_isAmmoOpen()) { + // if we're in the menu we just click in the point + HW_setCursor(HWX(pointWhereToClick.x), HWY(pointWhereToClick.y)); + HW_click(); + } else + if (isSingleClick) { + // if they tapped in the screen we trick the system so that camera doesn't move + HW_saveCursor(FALSE); + HW_setCursor(HWX(pointWhereToClick.x), HWY(pointWhereToClick.y)); + HW_click(); + HW_saveCursor(TRUE); + + // and remove the label (if any) + [[self.view viewWithTag:5599] removeFromSuperview]; + } else { + // TODO: only do this if the weapon does require a further click + // if no click, then ask for tapping again + CGPoint currentPosition = [[touches anyObject] locationInView:self.view]; + UILabel *tapAgain = [[UILabel alloc] initWithFrame:CGRectMake(currentPosition.x-100, currentPosition.y + 10, 200, 25)]; + tapAgain.text = NSLocalizedString(@"Tap again to confirm",@"from the overlay"); + tapAgain.backgroundColor = [UIColor clearColor]; + tapAgain.tag = 5599; + tapAgain.textColor = [UIColor blueColor]; + tapAgain.textAlignment = UITextAlignmentCenter; + tapAgain.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; + [self.view addSubview:tapAgain]; + [tapAgain release]; + } + + pointWhereToClick = CGPointZero; + initialDistanceForPinching = 0; + isSingleClick = NO; } -(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { @@ -393,10 +429,15 @@ switch ([touches count]) { case 1: + isSingleClick = NO; + currentPosition = [touch locationInView:self.view]; if (HW_isAmmoOpen()) { - currentPosition = [touch locationInView:self.view]; DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y)); HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); + pointWhereToClick = currentPosition; + } else { + DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y)); + HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); } break; case 2: diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Classes/PascalImports.h --- a/project_files/HedgewarsMobile/Classes/PascalImports.h Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Sat Jul 10 18:43:28 2010 +0200 @@ -55,6 +55,7 @@ void HW_setLandscape(BOOL); void HW_setCursor(int x, int y); + void HW_saveCursor(BOOL reset); BOOL HW_isAmmoOpen(void); #ifdef __cplusplus } diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Jul 10 18:43:28 2010 +0200 @@ -119,6 +119,7 @@ 61799289114AE08700BA94A9 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 61798A5E114AE08600BA94A9 /* Data */; }; 6183D83E11E2BCE200A88903 /* LI-ipad-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83C11E2BCE200A88903 /* LI-ipad-Landscape.png */; }; 6183D83F11E2BCE200A88903 /* LI-iphone-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83D11E2BCE200A88903 /* LI-iphone-Landscape.png */; }; + 619C09EA11E8B8D600F1DF16 /* title_small.png in Resources */ = {isa = PBXBuildFile; fileRef = 619C09E911E8B8D600F1DF16 /* title_small.png */; }; 61A1188511683A8C00359010 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A117FE1168322700359010 /* CoreGraphics.framework */; }; 61A118D311683CD100359010 /* HedgewarsTitle.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9CB1155A28C00C2203D /* HedgewarsTitle.png */; }; 61C3255B1179A384001E70B1 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61C3255A1179A384001E70B1 /* OpenAL.framework */; }; @@ -378,6 +379,7 @@ 6183D83C11E2BCE200A88903 /* LI-ipad-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "LI-ipad-Landscape.png"; path = "Resources/Icons/LI-ipad-Landscape.png"; sourceTree = ""; }; 6183D83D11E2BCE200A88903 /* LI-iphone-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "LI-iphone-Landscape.png"; path = "Resources/Icons/LI-iphone-Landscape.png"; sourceTree = ""; }; 618736B8118CA28600123B23 /* GearDrawing.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GearDrawing.inc; path = ../../hedgewars/GearDrawing.inc; sourceTree = SOURCE_ROOT; }; + 619C09E911E8B8D600F1DF16 /* title_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = title_small.png; path = "Resources/Frontend-iPhone/title_small.png"; sourceTree = ""; }; 61A117FE1168322700359010 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 61C3251D1179A300001E70B1 /* libopenalbridge.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libopenalbridge.a; sourceTree = BUILT_PRODUCTS_DIR; }; 61C3255A1179A384001E70B1 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; @@ -765,6 +767,7 @@ 61F903E311DF584D0068B24D /* Frontend-iPhone */ = { isa = PBXGroup; children = ( + 619C09E911E8B8D600F1DF16 /* title_small.png */, 61F903E411DF58550068B24D /* backgroundBottom.png */, 61F903E511DF58550068B24D /* backgroundCenter.png */, 61F903E611DF58550068B24D /* backgroundLeft.png */, @@ -1052,6 +1055,7 @@ 61F7A43E11E290650040BA66 /* iTunesArtwork.png in Resources */, 6183D83E11E2BCE200A88903 /* LI-ipad-Landscape.png in Resources */, 6183D83F11E2BCE200A88903 /* LI-iphone-Landscape.png in Resources */, + 619C09EA11E8B8D600F1DF16 /* title_small.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Info.plist --- a/project_files/HedgewarsMobile/Info.plist Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Info.plist Sat Jul 10 18:43:28 2010 +0200 @@ -42,5 +42,7 @@ LI-ipad UILaunchImageFile~iphone LI-iphone + UIApplicationExitsOnSuspend + diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Resources/Frontend-iPhone/title.png Binary file project_files/HedgewarsMobile/Resources/Frontend-iPhone/title.png has changed diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Resources/Frontend-iPhone/title_small.png Binary file project_files/HedgewarsMobile/Resources/Frontend-iPhone/title_small.png has changed diff -r 130c24d74043 -r c0d82112f479 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib Fri Jul 09 20:09:46 2010 -0400 +++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib Sat Jul 10 18:43:28 2010 +0200 @@ -12,6 +12,7 @@ YES + YES @@ -46,7 +47,6 @@ 274 {{0, 21}, {480, 278}} - 3 MCAwAA @@ -62,9 +62,8 @@ 293 - {{121, 25}, {240, 52}} + {{118, 25}, {240, 52}} - NO NO 4 @@ -72,7 +71,7 @@ IBCocoaTouchFramework NSImage - title.png + title_small.png @@ -80,7 +79,6 @@ 289 {{240, 102}, {220, 52}} - 1 MCAwIDAgMAA @@ -117,7 +115,6 @@ 265 {{240, 177}, {220, 52}} - 1 MCAwIDAgMAA @@ -145,7 +142,6 @@ 260 {{12, 144}, {220, 52}} - 1 MCAwIDAgMAA @@ -173,7 +169,6 @@ 292 {{37, 102}, {168, 21}} - NO YES NO @@ -198,7 +193,6 @@ 269 {{209, 237}, {59, 52}} - NO NO 2 @@ -222,7 +216,6 @@ 290 {480, 17} - NO NO 4 @@ -238,7 +231,6 @@ 266 {{0, 297}, {480, 23}} - NO NO 4 @@ -254,7 +246,6 @@ 292 {{20, 270}, {18, 19}} - NO 3 IBCocoaTouchFramework @@ -273,7 +264,6 @@ {480, 320} - 1 MCAwIDAAA @@ -366,13 +356,13 @@ - + @@ -793,7 +783,7 @@ playButton.png settingsButton.png storeButton.png - title.png + title_small.png YES @@ -802,7 +792,7 @@ {480, 21} {217, 51} {216, 51} - {57, 51} + {61, 59} {216, 51} {262, 84}