and now for something completely different, overlay refactoring!
authorkoda
Wed, 20 Apr 2011 05:26:47 +0200
changeset 5166 d1eb1560b4d5
parent 5165 91fb710a6668
child 5167 7b515d0945b1
and now for something completely different, overlay refactoring! updated project files with new certificate info removed some warnings
hedgewars/PascalExports.pas
hedgewars/hwLibrary.pas
hedgewars/hwengine.pas
hedgewars/uLandObjects.pas
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m
project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
project_files/HedgewarsMobile/Classes/OverlayViewController.h
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/PascalExports.pas	Tue Apr 19 15:34:21 2011 -0400
+++ b/hedgewars/PascalExports.pas	Wed Apr 20 05:26:47 2011 +0200
@@ -28,10 +28,11 @@
  *           http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl
  *)
 interface
-uses uTypes, uConsts, uVariables, GLunit, uKeys, uChat, uSound, uAmmos, uUtils,
+uses uTypes, uConsts, uVariables, GLunit, uKeys, uSound, uAmmos, uUtils,
      uCommands, uMobile;
 
 {$INCLUDE "config.inc"}
+procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export;
 
 implementation
 {$IFDEF HWLIBRARY}
@@ -165,12 +166,6 @@
     chatAction:= true;
 end;
 
-procedure HW_chatEnd; cdecl; export;
-begin
-    KeyPressChat(27); // esc - cleans buffer
-    KeyPressChat(13); // enter - removes chat
-end;
-
 procedure HW_screenshot; cdecl; export;
 begin
     flagMakeCapture:= true;
--- a/hedgewars/hwLibrary.pas	Tue Apr 19 15:34:21 2011 -0400
+++ b/hedgewars/hwLibrary.pas	Wed Apr 20 05:26:47 2011 +0200
@@ -25,7 +25,7 @@
 // to make these functions available in the C/C++/Objective-C source files
 // (add "#include PascalImports.h" near the top of these files if it's not there yet)
 uses PascalExports, hwengine;
-exports Game;
+exports Game, HW_versionInfo;
 begin
 
 end.
--- a/hedgewars/hwengine.pas	Tue Apr 19 15:34:21 2011 -0400
+++ b/hedgewars/hwengine.pas	Wed Apr 20 05:26:47 2011 +0200
@@ -132,6 +132,8 @@
     SDL_RenderClear(SDLrender);
     SDL_DestroyRenderer(SDLrender);
     SDL_DestroyWindow(SDLwindow);
+    SDLrender:= nil;
+    SDLwindow:= nil;
 {$ENDIF}
     SDL_Quit();
     isTerminated:= false;
--- a/hedgewars/uLandObjects.pas	Tue Apr 19 15:34:21 2011 -0400
+++ b/hedgewars/uLandObjects.pas	Wed Apr 20 05:26:47 2011 +0200
@@ -368,7 +368,7 @@
 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
 var s, key: shortstring;
     f: textfile;
-    i, ii, numFlakes: LongInt;
+    i, ii: LongInt;
     c1, c2: TSDL_Color;
 
     procedure CheckRect(Width, Height, x, y, w, h: LongWord);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Wed Apr 20 05:26:47 2011 +0200
@@ -59,6 +59,7 @@
 #define IS_IPAD()               (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
 #define IS_NOT_POWERFUL()       ([modelType() hasPrefix:@"iPhone1"] || [modelType() hasPrefix:@"iPod1,1"] || [modelType() hasPrefix:@"iPod2,1"])
 #define IS_NOT_VERY_POWERFUL()  ([modelType() hasPrefix:@"iPad1"] || [modelType() hasPrefix:@"iPhone2"] || [modelType() hasPrefix:@"iPod3"] || [modelType() hasPrefix:@"iPod4"] )
+#define IS_VERY_POWERFUL()      (IS_NOT_POWERFUL() == NO && IS_NOT_VERY_POWERFUL() == NO)
 
 #define DEFAULT_NETGAME_PORT    46631
 
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Wed Apr 20 05:26:47 2011 +0200
@@ -148,7 +148,8 @@
         [UIView setAnimationDuration:1];
         blackView.alpha = 1;
         [UIView commitAnimations];
-    }
+    } else
+        blackView.alpha = 1;
 
     // prepare options for overlay and add it to the future sdl uiwindow
     NSDictionary *overlayOptions = [[NSDictionary alloc] initWithObjectsAndKeys:
@@ -162,7 +163,6 @@
     [self startGameEngine];
 
     // now we can remove the cover with a transition
-    blackView.alpha = 1;
     [UIView beginAnimations:@"fade in" context:NULL];
     [UIView setAnimationDuration:1];
     blackView.alpha = 0;
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Wed Apr 20 05:26:47 2011 +0200
@@ -27,12 +27,6 @@
 #import "Appirater.h"
 #include <unistd.h>
 
-#ifdef main
-#undef main
-#endif
-
-#define BLACKVIEW_TAG 17935
-#define SECONDBLACKVIEW_TAG 48620
 
 @implementation SDLUIKitDelegate (customDelegate)
 
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Wed Apr 20 05:26:47 2011 +0200
@@ -88,8 +88,7 @@
         [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35];
     }
 
-//    HW_chatEnd();
-//    SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow());
+    SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow());
 
     if (shouldTakeScreenshot) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please wait"
@@ -109,7 +108,6 @@
         [self performSelector:@selector(saveCurrentScreenToPhotoAlbum:) withObject:alert afterDelay:0.3];
     }
     shouldTakeScreenshot = NO;
-
 }
 
 #pragma mark -
@@ -202,12 +200,12 @@
     }
 
     if ([actionSheet cancelButtonIndex] != buttonIndex) {
-        if (IS_DUALHEAD())
-            [[NSNotificationCenter defaultCenter] postNotificationName:@"remove overlay" object:nil];
+        SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow());
         HW_terminate(NO);
     }
 }
 
+#pragma mark -
 #pragma mark save screenshot
 //by http://www.bit-101.com/blog/?p=1861
 // callback for CGDataProviderCreateWithData
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Wed Apr 20 05:26:47 2011 +0200
@@ -40,7 +40,6 @@
 
     // the objc ammomenu
     AmmoMenuViewController *amvc;
-    BOOL wasVisible;
     
     // ths touch section
     CGFloat initialDistanceForPinching;
@@ -54,7 +53,6 @@
     
     // dual head support
     NSInteger initialScreenCount;
-    NSInteger a, b;
 }
 
 @property (nonatomic,retain) id popoverController;
@@ -63,6 +61,7 @@
 @property (nonatomic,retain) AmmoMenuViewController *amvc;
 @property (assign) BOOL useClassicMenu;
 @property (assign) NSInteger initialOrientation;
+@property (assign) NSInteger initialScreenCount;
 
 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
 -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Wed Apr 20 05:26:47 2011 +0200
@@ -39,7 +39,7 @@
                             [[self.view viewWithTag:GRENADE_TAG] removeFromSuperview];
 
 @implementation OverlayViewController
-@synthesize popoverController, popupMenu, helpPage, amvc, useClassicMenu, initialOrientation;
+@synthesize popoverController, popupMenu, helpPage, amvc, useClassicMenu, initialScreenCount, initialOrientation;
 
 #pragma mark -
 #pragma mark rotation
@@ -51,74 +51,39 @@
     return rotationManager(interfaceOrientation);
 }
 
-// pause the game and remove objc menus so that animation is smoother
--(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation duration:(NSTimeInterval) duration{
+// while in dual head the above rotation functions are not called
+-(void) handleRotationEvent:(NSNotification *)notification {
     if (isGameRunning() == NO)
         return;
 
-    HW_pause();
-    [self dismissPopover];
+    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
+    UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
+    NSInteger angle_left = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 180 : 0;
+    NSInteger angle_right = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 0 : 180;
 
-    if (self.amvc.isVisible && IS_DUALHEAD() == NO) {
-        [self.amvc disappear];
-        wasVisible = YES;
-    } else
-        wasVisible = NO;
-
-    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
-
-    UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
-    switch (toInterfaceOrientation) {
+    if (IS_VERY_POWERFUL()) {
+        [UIView beginAnimations:@"overlay rotation" context:NULL];
+        [UIView setAnimationDuration:0.7];
+    }
+    switch (orientation) {
         case UIDeviceOrientationLandscapeLeft:
-            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(a));
+            self.view.frame = [[UIScreen mainScreen] bounds];
+            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
+            if (IS_DUALHEAD() == NO)
+                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(angle_left));
             break;
         case UIDeviceOrientationLandscapeRight:
-            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(b));
+            self.view.frame = [[UIScreen mainScreen] bounds];
+            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
+            if (IS_DUALHEAD() == NO)
+                sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(angle_right));
             break;
         default:
             // a debug log would spam too much
             break;
     }
-}
-
-// now restore previous state
--(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation) fromInterfaceOrientation {
-    if (isGameRunning() == NO)
-        return;
-
-    if (wasVisible || IS_DUALHEAD())
-        [self.amvc appearInView:self.view];
-    HW_pauseToggle();
-
-    [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
-}
-
-// while in dual head the above rotation functions are not called
--(void) dualHeadRotation:(NSNotification *)notification {
-    if (isGameRunning() == NO)
-        return;
-
-    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
-    UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
-
-    [UIView beginAnimations:@"rotation" context:NULL];
-    [UIView setAnimationDuration:0.7];
-    switch (orientation) {
-        case UIDeviceOrientationLandscapeLeft:
-            self.view.frame = [[UIScreen mainScreen] bounds];
-            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
-            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(a));
-            break;
-        case UIDeviceOrientationLandscapeRight:
-            self.view.frame = [[UIScreen mainScreen] bounds];
-            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
-            sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(b));
-            break;
-        default:
-            // a debug log would spam too much
-            break;
-    }
-    [UIView commitAnimations];
+    if (IS_VERY_POWERFUL())
+        [UIView commitAnimations];
 }
 
 #pragma mark -
@@ -127,8 +92,9 @@
     if ((self = [super initWithCoder:aDecoder])) {
         objcExportsInit();
         isAttacking = NO;
-        wasVisible = NO;
-        isPopoverVisible = NO;    // it is called "popover" even on the iphone
+        isPopoverVisible = NO;
+        initialScreenCount = (IS_DUALHEAD() ? 2 : 1);
+        initialOrientation = 0;
     }
     return self;
 }
@@ -137,41 +103,25 @@
     CGRect screenRect = [[UIScreen mainScreen] bounds];
     self.view.frame = CGRectMake(0, 0, screenRect.size.height, screenRect.size.width);
     self.view.center = CGPointMake(self.view.frame.size.height/2, self.view.frame.size.width/2);
-    self.view.alpha = 0;
-
-    // detrmine the quanitiy and direction of the rotation
-    if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
-        a = 180;
-        b = 0;
-    } else {
-        a = 0;
-        b = 180;
-    }
-
-    // get the number of screens to know the previous state whan a display is connected or detached
-    if ([UIScreen respondsToSelector:@selector(screens)])
-        initialScreenCount = [[UIScreen screens] count];
-    else
-        initialScreenCount = 1;
 
     // set initial orientation of the controller orientation
-        switch (self.interfaceOrientation) {
-            case UIDeviceOrientationLandscapeLeft:
-                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
-                break;
-            case UIDeviceOrientationLandscapeRight:
-                self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
-                break;
-            default:
-                DLog(@"Nope");
-                break;
-        }
-        [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
-        [[NSNotificationCenter defaultCenter] addObserver:self
-                                                 selector:@selector(dualHeadRotation:)
-                                                     name:UIDeviceOrientationDidChangeNotification
-                                                   object:nil];
-
+    switch (self.interfaceOrientation) {
+        case UIDeviceOrientationLandscapeLeft:
+            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
+            break;
+        case UIDeviceOrientationLandscapeRight:
+            self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
+            break;
+        default:
+            DLog(@"Nope");
+            break;
+    }
+    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(handleRotationEvent:)
+                                                 name:UIDeviceOrientationDidChangeNotification
+                                               object:nil];
+    
     // the timer used to dim the overlay
     dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6]
                                         interval:1000
@@ -202,56 +152,29 @@
     }
     
     // present the overlay
+    self.view.alpha = 0;
     [UIView beginAnimations:@"showing overlay" context:NULL];
     [UIView setAnimationDuration:2];
     self.view.alpha = 1;
     [UIView commitAnimations];
 }
 
--(void) numberOfScreensIncreased {
-    if (initialScreenCount == 1) {
-        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New display detected"
-                                                        message:NSLocalizedString(@"Hedgewars supports multi-monitor configurations, but the screen has to be connected before launching the game.",@"")
-                                                       delegate:nil
-                                              cancelButtonTitle:@"Ok"
-                                              otherButtonTitles:nil];
-        [alert show];
-        [alert release];
-        HW_pause();
-    }
-}
+-(void) viewDidUnload {
+    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+    [NSObject cancelPreviousPerformRequestsWithTarget:self
+                                             selector:@selector(unsetPreciseStatus)
+                                               object:nil];
 
--(void) numberOfScreensDecreased {
-    if (initialScreenCount == 2) {
-        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oh noes! Display disconnected"
-                                                        message:NSLocalizedString(@"A monitor has been disconnected while playing and this has ended the match! You need to restart the game if you wish to use the second display again.",@"")
-                                                       delegate:nil
-                                              cancelButtonTitle:@"Ok"
-                                              otherButtonTitles:nil];
-        [alert show];
-        [alert release];
-        HW_terminate(NO);
-    }
-}
-
-
--(void) showHelp:(id) sender {
-    if (self.helpPage == nil) {
-        NSString *xibName = (IS_IPAD() ? @"HelpPageInGameViewController-iPad" : @"HelpPageInGameViewController-iPhone");
-        self.helpPage = [[HelpPageViewController alloc] initWithNibName:xibName bundle:nil];
-    }
-    self.helpPage.view.alpha = 0;
-    [self.view addSubview:helpPage.view];
-    [UIView beginAnimations:@"helpingame" context:NULL];
-    self.helpPage.view.alpha = 1;
-    [UIView commitAnimations];
-    doNotDim();
-}
-
--(void) removeOverlay {
-    [self.popupMenu performSelectorOnMainThread:@selector(dismiss) withObject:nil waitUntilDone:YES];
-    [self.popoverController performSelectorOnMainThread:@selector(dismissPopoverAnimated:) withObject:nil waitUntilDone:YES];
-    [self.view performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
+    // only objects initialized in viewDidLoad should be here
+    dimTimer = nil;
+    self.helpPage = nil;
+    [self dismissPopover];
+    self.popoverController = nil;
+    self.amvc = nil;
+    MSG_DIDUNLOAD();
+    [super viewDidUnload];
 }
 
 -(void) didReceiveMemoryWarning {
@@ -269,23 +192,6 @@
     [super didReceiveMemoryWarning];
 }
 
--(void) viewDidUnload {
-    // only objects initialized in viewDidLoad should be here
-    if (IS_DUALHEAD())
-        [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [NSObject cancelPreviousPerformRequestsWithTarget:self
-                                             selector:@selector(unsetPreciseStatus)
-                                               object:nil];
-    dimTimer = nil;
-    self.helpPage = nil;
-    [self dismissPopover];
-    self.popoverController = nil;
-    self.amvc = nil;
-    MSG_DIDUNLOAD();
-    [super viewDidUnload];
-}
-
 -(void) dealloc {
     [popupMenu release];
     [helpPage release];
@@ -295,8 +201,34 @@
     [super dealloc];
 }
 
+-(void) numberOfScreensIncreased {
+    if (self.initialScreenCount == 1) {
+        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New display detected"
+                                                        message:NSLocalizedString(@"Hedgewars supports multi-monitor configurations, but the screen has to be connected before launching the game.",@"")
+                                                       delegate:nil
+                                              cancelButtonTitle:@"Ok"
+                                              otherButtonTitles:nil];
+        [alert show];
+        [alert release];
+        HW_pause();
+    }
+}
+
+-(void) numberOfScreensDecreased {
+    if (self.initialScreenCount == 2) {
+        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oh noes! Display disconnected"
+                                                        message:NSLocalizedString(@"A monitor has been disconnected while playing and this has ended the match! You need to restart the game if you wish to use the second display again.",@"")
+                                                       delegate:nil
+                                              cancelButtonTitle:@"Ok"
+                                              otherButtonTitles:nil];
+        [alert show];
+        [alert release];
+        HW_terminate(NO);
+    }
+}
+
 #pragma mark -
-#pragma mark overlay user interaction
+#pragma mark overlay appearance
 // nice transition for dimming, should be called only by the timer himself
 -(void) dimOverlay {
     if (isGameRunning()) {
@@ -313,6 +245,14 @@
     doNotDim();
 }
 
+-(void) removeOverlay {
+    [self.popupMenu performSelectorOnMainThread:@selector(dismiss) withObject:nil waitUntilDone:YES];
+    [self.popoverController performSelectorOnMainThread:@selector(dismissPopoverAnimated:) withObject:nil waitUntilDone:YES];
+    [self.view performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
+}
+
+#pragma mark -
+#pragma mark overlay user interaction
 // dim the overlay when there's no more input for a certain amount of time
 -(IBAction) buttonReleased:(id) sender {
     if (isGameRunning() == NO)
@@ -443,7 +383,20 @@
 }
 
 #pragma mark -
-#pragma mark other menu
+#pragma mark in-game menu and help page
+-(void) showHelp:(id) sender {
+    if (self.helpPage == nil) {
+        NSString *xibName = (IS_IPAD() ? @"HelpPageInGameViewController-iPad" : @"HelpPageInGameViewController-iPhone");
+        self.helpPage = [[HelpPageViewController alloc] initWithNibName:xibName bundle:nil];
+    }
+    self.helpPage.view.alpha = 0;
+    [self.view addSubview:helpPage.view];
+    [UIView beginAnimations:@"helpingame" context:NULL];
+    self.helpPage.view.alpha = 1;
+    [UIView commitAnimations];
+    doNotDim();
+}
+
 // present a further check before closing game
 -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
     if ([actionSheet cancelButtonIndex] != buttonIndex)
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Tue Apr 19 15:34:21 2011 -0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Wed Apr 20 05:26:47 2011 +0200
@@ -2507,13 +2507,13 @@
 			};
 			name = Release;
 		};
-		61022D7C12305A2800B08935 /* DistributionAppStore */ = {
+		61022D7C12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLY_RULES_IN_COPY_FILES = YES;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				CODE_SIGN_IDENTITY = "Don't Code Sign";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
+				CODE_SIGN_IDENTITY = "iPhone Distribution";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
 				FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B  -Sgix";
 				FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1;
 				FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas";
@@ -2552,9 +2552,9 @@
 				VALIDATE_PRODUCT = YES;
 				VALID_ARCHS = "armv7 armv6";
 			};
-			name = DistributionAppStore;
+			name = "Distro AppStore";
 		};
-		61022D7D12305A2800B08935 /* DistributionAppStore */ = {
+		61022D7D12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -2575,9 +2575,9 @@
 				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
 				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
-			name = DistributionAppStore;
+			name = "Distro AppStore";
 		};
-		61022D7E12305A2800B08935 /* DistributionAppStore */ = {
+		61022D7E12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -2588,9 +2588,9 @@
 				PRODUCT_NAME = fpc;
 				ZERO_LINK = NO;
 			};
-			name = DistributionAppStore;
+			name = "Distro AppStore";
 		};
-		61022D7F12305A2800B08935 /* DistributionAppStore */ = {
+		61022D7F12305A2800B08935 /* Distro AppStore */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
@@ -2599,9 +2599,9 @@
 				PRODUCT_NAME = UpdateDataFolder;
 				ZERO_LINK = NO;
 			};
-			name = DistributionAppStore;
+			name = "Distro AppStore";
 		};
-		6137064B117B1CB3004EE44A /* DistributionAdHoc */ = {
+		6137064B117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLY_RULES_IN_COPY_FILES = YES;
@@ -2646,9 +2646,9 @@
 				VALIDATE_PRODUCT = YES;
 				VALID_ARCHS = "armv7 armv6";
 			};
-			name = DistributionAdHoc;
+			name = "Distro Adhoc";
 		};
-		6137064C117B1CB3004EE44A /* DistributionAdHoc */ = {
+		6137064C117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -2667,9 +2667,9 @@
 				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
 				TARGETED_DEVICE_FAMILY = "$(inherited)";
 			};
-			name = DistributionAdHoc;
+			name = "Distro Adhoc";
 		};
-		6137064D117B1CB3004EE44A /* DistributionAdHoc */ = {
+		6137064D117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
@@ -2680,9 +2680,9 @@
 				PRODUCT_NAME = fpc;
 				ZERO_LINK = NO;
 			};
-			name = DistributionAdHoc;
+			name = "Distro Adhoc";
 		};
-		6137064F117B1CB3004EE44A /* DistributionAdHoc */ = {
+		6137064F117B1CB3004EE44A /* Distro Adhoc */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
@@ -2691,97 +2691,7 @@
 				PRODUCT_NAME = UpdateDataFolder;
 				ZERO_LINK = NO;
 			};
-			name = DistributionAdHoc;
-		};
-		6164429D11B5CDE500B9A6F3 /* Valgrind */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				APPLY_RULES_IN_COPY_FILES = YES;
-				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				CODE_SIGN_IDENTITY = "iPhone Developer: Vittorio Giovara (DC2BRETXAC)";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Vittorio Giovara (DC2BRETXAC)";
-				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B  -Sgix";
-				FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1;
-				FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas";
-				FPC_RTL_UNITS_BASE = /usr/local/lib/fpc;
-				FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -g -gl -gw2 -gt -ghttt -Xs-";
-				FPC_UNITS_PATH = "-Fu\"$(PROJECT_DIR)\"";
-				GCC_C_LANGUAGE_STANDARD = c99;
-				GCC_DEBUGGING_SYMBOLS = full;
-				GCC_FAST_MATH = NO;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					VALGRIND_REXEC,
-					DEBUG,
-				);
-				GCC_STRICT_ALIASING = YES;
-				GCC_THUMB_SUPPORT = NO;
-				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				HEADER_SEARCH_PATHS = (
-					"\"$(SRCROOT)/../../../Library/SDL/src/events\"",
-					"\"$(SRCROOT)/../../../Library/SDL/src/video\"/**",
-					"\"$(SRCROOT)/../../../Library/SDL/include/\"",
-					"\"$(SRCROOT)/../../../Library/SDL_net/\"",
-					"\"$(SRCROOT)/../../../Library/SDL_mixer/\"",
-				);
-				IPHONEOS_DEPLOYMENT_TARGET = 3.1;
-				ONLY_ACTIVE_ARCH = NO;
-				OTHER_LDFLAGS = (
-					"-lz",
-					"-Wl,-no_order_inits",
-				);
-				PREBINDING = NO;
-				SDKROOT = iphoneos;
-				TARGETED_DEVICE_FAMILY = "1,2";
-				VALIDATE_PRODUCT = NO;
-				VALID_ARCHS = "armv7 armv6";
-			};
-			name = Valgrind;
-		};
-		6164429E11B5CDE500B9A6F3 /* Valgrind */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PRECOMPILE_PREFIX_HEADER = YES;
-				GCC_PREFIX_HEADER = Hedgewars_Prefix.pch;
-				INFOPLIST_FILE = Info.plist;
-				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)\"",
-				);
-				PRODUCT_NAME = Hedgewars;
-				TARGETED_DEVICE_FAMILY = "$(inherited)";
-			};
-			name = Valgrind;
-		};
-		6164429F11B5CDE500B9A6F3 /* Valgrind */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				PREBINDING = NO;
-				PRODUCT_NAME = fpc;
-			};
-			name = Valgrind;
-		};
-		616442A111B5CDE500B9A6F3 /* Valgrind */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				PRODUCT_NAME = UpdateDataFolder;
-			};
-			name = Valgrind;
+			name = "Distro Adhoc";
 		};
 		6179928C114AE0C800BA94A9 /* Debug */ = {
 			isa = XCBuildConfiguration;
@@ -2834,8 +2744,8 @@
 			buildSettings = {
 				APPLY_RULES_IN_COPY_FILES = YES;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
-				CODE_SIGN_IDENTITY = "iPhone Developer: Vittorio Giovara (DC2BRETXAC)";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Vittorio Giovara (DC2BRETXAC)";
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B  -Sgix";
 				FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1;
@@ -2867,6 +2777,8 @@
 					"-Wl,-no_order_inits",
 				);
 				PREBINDING = NO;
+				PROVISIONING_PROFILE = "";
+				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				VALIDATE_PRODUCT = NO;
@@ -2928,9 +2840,8 @@
 			buildConfigurations = (
 				1D6058940D05DD3E006BFB54 /* Debug */,
 				1D6058950D05DD3E006BFB54 /* Release */,
-				6137064C117B1CB3004EE44A /* DistributionAdHoc */,
-				61022D7D12305A2800B08935 /* DistributionAppStore */,
-				6164429E11B5CDE500B9A6F3 /* Valgrind */,
+				6137064C117B1CB3004EE44A /* Distro Adhoc */,
+				61022D7D12305A2800B08935 /* Distro AppStore */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
@@ -2940,9 +2851,8 @@
 			buildConfigurations = (
 				6179928C114AE0C800BA94A9 /* Debug */,
 				6179928D114AE0C800BA94A9 /* Release */,
-				6137064F117B1CB3004EE44A /* DistributionAdHoc */,
-				61022D7F12305A2800B08935 /* DistributionAppStore */,
-				616442A111B5CDE500B9A6F3 /* Valgrind */,
+				6137064F117B1CB3004EE44A /* Distro Adhoc */,
+				61022D7F12305A2800B08935 /* Distro AppStore */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
@@ -2952,9 +2862,8 @@
 			buildConfigurations = (
 				928301180F10CAFD00CC5A3C /* Debug */,
 				928301190F10CAFD00CC5A3C /* Release */,
-				6137064D117B1CB3004EE44A /* DistributionAdHoc */,
-				61022D7E12305A2800B08935 /* DistributionAppStore */,
-				6164429F11B5CDE500B9A6F3 /* Valgrind */,
+				6137064D117B1CB3004EE44A /* Distro Adhoc */,
+				61022D7E12305A2800B08935 /* Distro AppStore */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
@@ -2964,9 +2873,8 @@
 			buildConfigurations = (
 				C01FCF4F08A954540054247B /* Debug */,
 				C01FCF5008A954540054247B /* Release */,
-				6137064B117B1CB3004EE44A /* DistributionAdHoc */,
-				61022D7C12305A2800B08935 /* DistributionAppStore */,
-				6164429D11B5CDE500B9A6F3 /* Valgrind */,
+				6137064B117B1CB3004EE44A /* Distro Adhoc */,
+				61022D7C12305A2800B08935 /* Distro AppStore */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;