BUUUUURN OBJC AMMOMENU BUUUURNhg diff! (on a separate note, this reduces the codesize by ~37k)
authorkoda
Sun, 05 Feb 2012 15:52:26 +0100
changeset 6624 e049b5bb0ad1
parent 6623 6bf169f1e97c
child 6625 2d8c5815292f
BUUUUURN OBJC AMMOMENU BUUUURNhg diff! (on a separate note, this reduces the codesize by ~37k)
hedgewars/uAmmos.pas
hedgewars/uMobile.pas
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/AmmoMenuViewController.h
project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m
project_files/HedgewarsMobile/Classes/CreationChamber.m
project_files/HedgewarsMobile/Classes/DefinesAndMacros.h
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m
project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.h
project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m
project_files/HedgewarsMobile/Classes/ObjcExports.m
project_files/HedgewarsMobile/Classes/OverlayViewController.h
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/uAmmos.pas	Sat Feb 04 23:06:22 2012 +0100
+++ b/hedgewars/uAmmos.pas	Sun Feb 05 15:52:26 2012 +0100
@@ -49,7 +49,7 @@
 var StoreCnt: Longword;
 
 implementation
-uses uLocale, uMobile, uVariables, uCommands, uUtils, uCaptions, uDebug;
+uses uLocale, uVariables, uCommands, uUtils, uCaptions, uDebug;
 
 type TAmmoCounts = array[TAmmoType] of Longword;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
@@ -273,7 +273,6 @@
                 end
             end
     end;
-uMobile.AmmoUpdate;
 end;
 
 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
--- a/hedgewars/uMobile.pas	Sat Feb 04 23:06:22 2012 +0100
+++ b/hedgewars/uMobile.pas	Sun Feb 05 15:52:26 2012 +0100
@@ -27,7 +27,6 @@
 procedure startLoadingIndicator; cdecl; external;
 procedure stopLoadingIndicator; cdecl; external;
 procedure saveFinishedSynching; cdecl; external;
-procedure updateVisualsNewTurn; cdecl; external;
 function  isApplePhone: Boolean; cdecl; external;
 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
 {$ENDIF}
@@ -36,7 +35,6 @@
 
 procedure GameLoading; inline;
 procedure GameLoaded; inline;
-procedure AmmoUpdate; // do not inline
 procedure NewTurnBeginning; inline;
 procedure SaveLoadingEnded; inline;
 
@@ -88,21 +86,11 @@
 {$ENDIF}
 end;
 
-procedure AmmoUpdate; // do not inline
-begin
-{$IFDEF IPHONEOS}
-    if (CurrentTeam = nil) or (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
-        exit(); // the other way around throws a compiler error
-    updateVisualsNewTurn();
-{$ENDIF}
-end;
-
 procedure NewTurnBeginning; inline;
 begin
 {$IFDEF IPHONEOS}
     clearView();
 {$ENDIF}
-    AmmoUpdate();
 end;
 
 procedure SaveLoadingEnded; inline;
--- a/hedgewars/uStore.pas	Sat Feb 04 23:06:22 2012 +0100
+++ b/hedgewars/uStore.pas	Sun Feb 05 15:52:26 2012 +0100
@@ -1055,18 +1055,14 @@
     // these values in x and y make the window appear in the center
     x:= SDL_WINDOWPOS_CENTERED_MASK;
     y:= SDL_WINDOWPOS_CENTERED_MASK;
-    flags:= SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN;
+    // SDL_WINDOW_RESIZABLE makes the window respond to rotation events on mobile devices
+    flags:= SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN or SDL_WINDOW_RESIZABLE;
 
     {$IFDEF MOBILE}
-    // make the sdl window appear on the second monitor when present
-    x:= x or (SDL_GetNumVideoDisplays() - 1);
-    y:= y or (SDL_GetNumVideoDisplays() - 1);
-
     if isPhone() then
         SDL_SetHint('SDL_IOS_ORIENTATIONS','LandscapeLeft LandscapeRight');
-
-    // on mobile the SDL_WINDOW_RESIZABLE makes the window respond to rotation events
-    flags:= flags or SDL_WINDOW_BORDERLESS or SDL_WINDOW_RESIZABLE;
+    // no need for borders on mobile devices
+    flags:= flags or SDL_WINDOW_BORDERLESS;
     {$ENDIF}
 
     if SDLwindow = nil then
--- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.h	Sat Feb 04 23:06:22 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * File created on 03/10/2010.
- */
-
-
-#import <UIKit/UIKit.h>
-
-
-@interface AmmoMenuViewController : UIViewController {
-    NSArray *buttonsArray;
-    NSArray *imagesArray;
-    
-    UILabel *nameLabel;
-    UILabel *extraLabel;
-    UILabel *captionLabel;
-
-    uint8_t *delay;
-    BOOL *shouldUpdateImage;
-    CGPoint currentPoint;
-    CGPoint placingPoint;
-    BOOL isVisible;
-}
-
-@property (retain) NSArray *buttonsArray;
-@property (retain) NSArray *imagesArray;
-@property (nonatomic,retain) UILabel *nameLabel;
-@property (nonatomic,retain) UILabel *extraLabel;
-@property (nonatomic,retain) UILabel *captionLabel;
-@property (assign) BOOL isVisible;
-
--(void) buttonPressed:(id) sender;
--(void) buttonReleased:(id) sender;
--(void) buttonCancelled:(id) sender;
--(void) appearInView:(UIView *)container;
--(void) disappear;
--(void) updateAmmoVisuals;
--(void) loadLabels;
--(void) loadAmmoStuff:(id) object;
-
-@end
--- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m	Sat Feb 04 23:06:22 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,390 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * File created on 03/10/2010.
- */
-
-
-#import "AmmoMenuViewController.h"
-#import <QuartzCore/QuartzCore.h>
-
-
-#define BTNS_PER_ROW         9
-#define DEFAULT_DESCRIPTION  IS_IPAD() ? \
-                             NSLocalizedString(@"Hold your finger on a weapon to see what it does.\nYou can move this window anywhere on the screen.",@"") : \
-                             NSLocalizedString(@"Hold your finger on a weapon to see what it does.\nTap anywhere to dismiss.",@"")
-
-@implementation AmmoMenuViewController
-@synthesize imagesArray, buttonsArray, nameLabel, extraLabel, captionLabel, isVisible;
-
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
-    return rotationManager(interfaceOrientation);
-}
-
-#pragma mark -
-#pragma mark view handling
--(void) viewDidLoad {    
-    self.view.frame = CGRectMake(0, 0, 480, 320);
-    self.view.backgroundColor = [UIColor blackColor];
-    self.view.layer.borderColor = [[UIColor whiteColor] CGColor];
-    self.view.layer.borderWidth = 1.3f;
-    [self.view.layer setCornerRadius:10];
-    [self.view.layer setMasksToBounds:YES];
-    self.view.autoresizingMask = UIViewAutoresizingNone;
-    placingPoint = CGPointMake(-1, -1);
-
-    self.isVisible = NO;
-    delay = (uint8_t *)calloc(HW_getNumberOfWeapons(), sizeof(uint8_t));
-    HW_getAmmoDelays(delay);
-
-    shouldUpdateImage = (BOOL *)calloc(HW_getNumberOfWeapons(), sizeof(BOOL));
-
-    [super viewDidLoad];
-}
-
--(void) viewWillAppear:(BOOL)animated {
-    [self updateAmmoVisuals];
-    [super viewWillAppear:animated];
-}
-
--(void) appearInView:(UIView *)container {
-    [self viewWillAppear:YES];
-    [container addSubview:self.view];
-
-    if (placingPoint.x == -1 || placingPoint.y == -1)
-        placingPoint = container.center;
-    self.view.center = placingPoint;
-
-    self.isVisible = YES;
-    if (IS_IPAD() == NO)
-        HW_pause();
-}
-
--(void) disappear {
-    if (self.isVisible)
-        [self.view removeFromSuperview];
-    self.isVisible = NO;
-    placingPoint = self.view.center;
-    if (IS_IPAD() == NO)
-        HW_pauseToggle();
-}
-
-#pragma mark -
-#pragma mark drawing
--(void) loadLabels {
-    int x = 12;
-    int y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18;
-    UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 200, 20)];
-    name.backgroundColor = [UIColor clearColor];
-    name.textColor = [UIColor darkYellowColor];
-    name.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
-    self.nameLabel = name;
-    [self.view addSubview:self.nameLabel];
-    [name release];
-
-    UILabel *caption = [[UILabel alloc] initWithFrame:CGRectMake(x+200, y, 220, 20)];
-    caption.backgroundColor = [UIColor clearColor];
-    caption.textColor = [UIColor whiteColor];
-    caption.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
-    caption.adjustsFontSizeToFitWidth = YES;
-    caption.minimumFontSize = 8;
-    self.captionLabel = caption;
-    [self.view addSubview:self.captionLabel];
-    [caption release];
-
-    UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, self.view.frame.size.height-50, 415, 53)];
-    description.backgroundColor = [UIColor clearColor];
-    description.textColor = [UIColor whiteColor];
-    description.text = DEFAULT_DESCRIPTION;
-    description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]];
-    description.adjustsFontSizeToFitWidth = YES;
-    description.minimumFontSize = 8;
-    description.numberOfLines = 0;
-    self.extraLabel = description;
-    [self.view addSubview:self.extraLabel];
-    [description release];
-}
-
--(void) loadAmmoStuff:(id) object {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
-    UIImage *ammoStoreImage = [[UIImage alloc] initWithContentsOfFile:str];
-    CGFloat theScale = [[UIScreen mainScreen] safeScale];
-
-    NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()];
-    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()];
-    int i, j, e;
-    for (i = 0, j = 0, e = 0; i < HW_getNumberOfWeapons(); i++) {
-        int x, y;
-        float w, radius;
-        
-        // move utilities aside and make 'em rounded
-        if (HW_isWeaponAnEffect(i)) {
-            x = 432;
-            y = 20 + 48*e++;
-            w = 1.5;
-            radius = 22;
-        } else {
-            x = 10+(j%BTNS_PER_ROW)*44;
-            y = 10+(j/BTNS_PER_ROW)*44;
-            if (j / BTNS_PER_ROW % 2 != 0)
-                x += 20;
-            w = 1;
-            radius = 6;
-            j++;
-        }
-
-        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
-        button.frame = CGRectMake(x, y, 40, 40);
-        button.tag = i;
-        button.layer.borderColor = [[UIColor lightYellowColor] CGColor];
-        button.layer.borderWidth = w;
-        [button.layer setCornerRadius:radius];
-        [button.layer setMasksToBounds:YES];
-        [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown];
-        [button addTarget:self action:@selector(buttonReleased:) forControlEvents:UIControlEventTouchUpInside];
-        [button addTarget:self action:@selector(buttonCancelled:) forControlEvents:UIControlEventTouchUpOutside|UIControlEventTouchCancel];
-        [button setTitleColor:[UIColor lightYellowColor] forState:UIControlStateNormal];
-        button.titleLabel.backgroundColor = [UIColor blackColor];
-        button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]];
-        [button.titleLabel.layer setCornerRadius:3];
-        [button.titleLabel.layer setMasksToBounds:YES];
-        button.titleLabel.layer.borderColor = [[UIColor whiteColor] CGColor];
-        button.titleLabel.layer.borderWidth = 1;
-        [self.view addSubview:button];
-        [array addObject:button];
-
-        int size = 32 * theScale;
-        int x_src = ((i*size)/(int)(ammoStoreImage.size.height * theScale))*size;
-        int y_src = (i*size)%(int)(ammoStoreImage.size.height * theScale);
-        UIImage *img = [ammoStoreImage cutAt:CGRectMake(x_src, y_src, size, size)];
-        [imgs addObject:img];
-    }
-    [self performSelectorOnMainThread:@selector(setButtonsArray:) withObject:array waitUntilDone:NO];
-    [array release];
-
-    [self performSelectorOnMainThread:@selector(setImagesArray:) withObject:imgs waitUntilDone:NO];
-    [imgs release];
-    [ammoStoreImage release];
-
-    [self performSelectorOnMainThread:@selector(loadLabels) withObject:nil waitUntilDone:NO];
-    
-    [self performSelectorOnMainThread:@selector(updateAmmoVisuals) withObject:nil waitUntilDone:YES];
-    UIActivityIndicatorView *spinner = (UIActivityIndicatorView *)object;
-    [spinner stopAnimating];
-    [pool drain];
-}
-
--(void) updateAmmoVisuals {
-    if (self.buttonsArray == nil || self.imagesArray == nil) {
-        UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
-        spinner.hidesWhenStopped = YES;
-        spinner.center = self.view.center;
-        [spinner startAnimating];
-        [self.view addSubview:spinner];
-        [NSThread detachNewThreadSelector:@selector(loadAmmoStuff:) toTarget:self withObject:spinner];
-        [spinner release];
-        return;
-    }
-    
-    int *loadout = (int *)calloc(HW_getNumberOfWeapons(), sizeof(int));
-    int res = HW_getAmmoCounts(loadout);
-    int turns = HW_getTurnsForCurrentTeam();
-    
-    if (res == 0) {
-        self.view.userInteractionEnabled = YES;
-        
-        for (int i = 0; i < HW_getNumberOfWeapons(); i++) {
-            UIButton *button = [self.buttonsArray objectAtIndex:i];
-            if (loadout[i] > 0) {
-                if (delay[i]-turns >= 0) {
-                    button.layer.borderColor = [[UIColor lightGrayColor] CGColor];
-                    [button setTitle:[NSString stringWithFormat:@" %d ",delay[i]-turns+1] forState:UIControlStateNormal];
-                    if (button.currentBackgroundImage == nil || shouldUpdateImage[i] == NO) {
-                        UIImage *img = [self.imagesArray objectAtIndex:i];
-                        [button setBackgroundImage:[img convertToGrayScale] forState:UIControlStateNormal];
-                        shouldUpdateImage[i] = YES;
-                    }
-                } else {
-                    button.layer.borderColor = [[UIColor lightYellowColor] CGColor];
-                    [button setTitle:nil forState:UIControlStateNormal];
-                    if (button.currentBackgroundImage == nil || shouldUpdateImage[i] == YES) {
-                        UIImage *img = [self.imagesArray objectAtIndex:i];
-                        [button setBackgroundImage:img forState:UIControlStateNormal];
-                        shouldUpdateImage[i] = NO;
-                    }
-                }
-                button.enabled = YES;
-            } else {
-                if (button.enabled == YES)
-                    [button setBackgroundImage:nil forState:UIControlStateNormal];
-                button.layer.borderColor = [[UIColor darkGrayColor] CGColor];
-                button.enabled = NO;
-                shouldUpdateImage[i] = NO;
-            }
-        }
-    } else {
-        self.view.userInteractionEnabled = NO;
-    }
-
-    free(loadout);
-    loadout = NULL;
-}
-
-#pragma mark -
-#pragma mark user interaction
--(void) buttonPressed:(id) sender {
-    UIButton *theButton = (UIButton *)sender;
-    if (self.nameLabel == nil || self.extraLabel == nil)
-        [self loadLabels];
-
-    self.nameLabel.text = [NSString stringWithUTF8String:HW_getWeaponNameByIndex(theButton.tag)];
-    // description contains a lot of unnecessary stuff, we clean it by removing .|, !| and ?|
-    NSString *description = [NSString stringWithUTF8String:HW_getWeaponDescriptionByIndex(theButton.tag)];
-    NSArray *elements = [description componentsSeparatedByString:@".|"];
-    NSArray *purgedElements = [[elements objectAtIndex:0] componentsSeparatedByString:@"!|"];
-    NSArray *morePurgedElements = [[purgedElements objectAtIndex:0] componentsSeparatedByString:@"?|"];
-    self.extraLabel.text = [[[morePurgedElements objectAtIndex:0] stringByReplacingOccurrencesOfString:@"|" withString:@" "] stringByAppendingString:@"."];
-    if (theButton.currentTitle != nil)
-        self.captionLabel.text = NSLocalizedString(@"This weapon is locked",@"");
-    else
-        self.captionLabel.text = [NSString stringWithUTF8String:HW_getWeaponCaptionByIndex(theButton.tag)];
-    
-    self.nameLabel.backgroundColor = [UIColor blackColor];
-    self.captionLabel.backgroundColor = [UIColor blackColor];
-    self.extraLabel.backgroundColor = [UIColor blackColor];
-
-    int y, x = 8;
-    // display labels on top for lower buttons
-    if (theButton.tag > 41)
-        y = 5;
-    else
-        y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*40;
-
-    self.nameLabel.frame = CGRectMake(x, y, 200, 20);
-    self.captionLabel.frame = CGRectMake(x+200, y, 220, 20);
-    self.extraLabel.frame = CGRectMake(x+2, y+20, 415, 53);
-}
-
--(void) buttonCancelled:(id) sender {
-    self.nameLabel.text = nil;
-    self.extraLabel.text = nil;
-    self.captionLabel.text = nil;
-    self.extraLabel.backgroundColor = [UIColor clearColor];
-    self.captionLabel.backgroundColor = [UIColor clearColor];
-    self.nameLabel.backgroundColor = [UIColor clearColor];
-}
-
--(void) buttonReleased:(id) sender {
-    UIButton *theButton = (UIButton *)sender;
-    if (self.nameLabel == nil || self.extraLabel == nil)
-        [self loadLabels];
-
-    if (theButton.currentTitle == nil) {
-        HW_setWeapon(theButton.tag);
-        [AudioManagerController playClickSound];
-        if (IS_DUALHEAD() == NO)
-            [self disappear];
-    }
-    [self buttonCancelled:sender];
-}
-
--(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
-    NSSet *allTouches = [event allTouches];
-
-    if (IS_IPAD() && [touches count] == 1) {
-        self.view.layer.borderWidth = 3.5;
-        currentPoint = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view];
-    }
-
-    if (IS_IPAD() == NO)
-        [self disappear];
-}
-
--(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
-    self.view.layer.borderWidth = 1.3;
-}
-
-// better window dragging implementation by
-// http://iphonedevelopertips.com/graphics/drag-an-image-within-the-bounds-of-superview.html
--(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
-    if (IS_IPAD() && [touches count] == 1) {
-        // Get active location upon move
-        CGPoint activePoint = [[touches anyObject] locationInView:self.view];
-
-        // Determine new point based on where the touch is now located
-        CGPoint newPoint = CGPointMake(self.view.center.x + (activePoint.x - currentPoint.x),
-                                       self.view.center.y + (activePoint.y - currentPoint.y));
-
-        // Make sure we stay within the bounds of the parent view
-        float midPointX = CGRectGetMidX(self.view.bounds);
-        if (newPoint.x > self.view.superview.bounds.size.width  - midPointX)
-            newPoint.x = self.view.superview.bounds.size.width - midPointX;
-        else if (newPoint.x < midPointX)
-            newPoint.x = midPointX;
-
-        float midPointY = CGRectGetMidY(self.view.bounds);
-        if (newPoint.y > self.view.superview.bounds.size.height  - midPointY)
-            newPoint.y = self.view.superview.bounds.size.height - midPointY;
-        else if (newPoint.y < midPointY)
-            newPoint.y = midPointY;
-
-        self.view.center = newPoint;
-    }
-}
-
--(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
-    [self touchesEnded:touches withEvent:event];
-}
-
-#pragma mark -
-#pragma mark memory
--(void) didReceiveMemoryWarning {
-    self.imagesArray = nil;
-    if (self.isVisible == NO)
-        self.buttonsArray = nil;
-    self.nameLabel = nil;
-    self.extraLabel = nil;
-    self.captionLabel = nil;
-    MSG_MEMCLEAN();
-    [super didReceiveMemoryWarning];
-}
-
--(void) viewDidUnload {
-    self.imagesArray = nil;
-    self.buttonsArray = nil;
-    self.nameLabel = nil;
-    self.extraLabel = nil;
-    self.captionLabel = nil;
-    free(delay);
-    delay = NULL;
-    free(shouldUpdateImage);
-    shouldUpdateImage = NULL;
-    MSG_DIDUNLOAD();
-    [super viewDidUnload];
-}
-
--(void) dealloc {
-    releaseAndNil(nameLabel);
-    releaseAndNil(extraLabel);
-    releaseAndNil(captionLabel);
-    releaseAndNil(imagesArray);
-    releaseAndNil(buttonsArray);
-    [super dealloc];
-}
-
-@end
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m	Sun Feb 05 15:52:26 2012 +0100
@@ -31,7 +31,6 @@
     [settings setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"];
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"];
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sound"];
-    [settings setObject:[NSNumber numberWithBool:NO] forKey:@"classic_menu"];
     [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sync_ws"];
 
     // don't overwrite these two strings when present
--- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sun Feb 05 15:52:26 2012 +0100
@@ -74,7 +74,6 @@
 #define MSG_MEMCLEAN()          DLog(@"has cleaned up some memory");
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
 
-#define IS_DUALHEAD()           ([[UIScreen class] respondsToSelector:@selector(screens)] && [[UIScreen screens] count] > 1)
 #define IS_IPAD()               (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
 #define IS_NOT_POWERFUL(x)      ([x hasPrefix:@"iPhone1"] || [x hasPrefix:@"iPod1,1"] || [x hasPrefix:@"iPod2,1"])
 #define IS_NOT_VERY_POWERFUL(x) ([x hasPrefix:@"iPad1"] || [x hasPrefix:@"iPhone2"] || [x hasPrefix:@"iPod3"] || [x hasPrefix:@"iPod4"])
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sun Feb 05 15:52:26 2012 +0100
@@ -123,15 +123,9 @@
     NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt",[[NSLocale preferredLanguages] objectAtIndex:0]];
     NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
 
-    if (IS_DUALHEAD()) {
-        CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds];
-        width = screenBounds.size.width;
-        height = screenBounds.size.height;
-    } else {
-        CGRect screenBounds = [[UIScreen mainScreen] safeBounds];
-        width = screenBounds.size.width;
-        height = screenBounds.size.height;
-    }
+    CGRect screenBounds = [[UIScreen mainScreen] safeBounds];
+    width = screenBounds.size.width;
+    height = screenBounds.size.height;
 
     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)];
     NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", (int)(height * screenScale)];
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Sun Feb 05 15:52:26 2012 +0100
@@ -88,9 +88,6 @@
         case 90:    //synched weapons/scheme
             [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"sync_ws"];
             break;
-        case 60:    //classic menu
-            [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"classic_menu"];
-            break;
         default:
             DLog(@"Wrong tag");
             break;
@@ -121,7 +118,7 @@
             return 2;
             break;
         case 2:     // other options
-            return 3;
+            return 2;
             break;
         default:
             DLog(@"Nope");
@@ -234,12 +231,6 @@
                     switchContent.on = [[settings objectForKey:@"sync_ws"] boolValue];
                     switchContent.tag = 90;
                     break;
-                case 2:
-                    cell.textLabel.text = NSLocalizedString(@"Classic Ammo Menu", @"");
-                    cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@"from the settings table");
-                    switchContent.on = [[settings objectForKey:@"classic_menu"] boolValue];
-                    switchContent.tag = 60;
-                    break;
                 default:
                     DLog(@"Nope");
                     break;
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.h	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.h	Sun Feb 05 15:52:26 2012 +0100
@@ -27,12 +27,10 @@
 @interface HedgewarsAppDelegate : SDLUIKitDelegate {
     MainMenuViewController *mainViewController;
     UIWindow *uiwindow;
-    UIWindow *secondWindow;
 }
 
 @property (nonatomic,retain) MainMenuViewController *mainViewController;
 @property (nonatomic,retain) UIWindow *uiwindow;
-@property (nonatomic,retain) UIWindow *secondWindow;
 
 @end
 
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m	Sun Feb 05 15:52:26 2012 +0100
@@ -34,7 +34,7 @@
 @end
 
 @implementation HedgewarsAppDelegate
-@synthesize mainViewController, uiwindow, secondWindow;
+@synthesize mainViewController, uiwindow;
 
 #pragma mark -
 #pragma mark AppDelegate methods
@@ -42,7 +42,6 @@
     if (self = [super init]){
         mainViewController = nil;
         uiwindow = nil;
-        secondWindow = nil;
     }
     return self;
 }
@@ -50,7 +49,6 @@
 -(void) dealloc {
     [mainViewController release];
     [uiwindow release];
-    [secondWindow release];
     [super dealloc];
 }
 
@@ -67,20 +65,6 @@
     [self.mainViewController release];
     self.uiwindow.backgroundColor = [UIColor blackColor];
     [self.uiwindow makeKeyAndVisible];
-
-    // check for dual monitor support
-    if (IS_DUALHEAD()) {
-        DLog(@"Dualhead mode");
-        self.secondWindow = [[UIWindow alloc] initWithFrame:[[[UIScreen screens] objectAtIndex:1] bounds]];
-        self.secondWindow.backgroundColor = [UIColor blackColor];
-        self.secondWindow.screen = [[UIScreen screens] objectAtIndex:1];
-        UIImage *titleImage = [UIImage imageWithContentsOfFile:@"title.png"];
-        UIImageView *titleView = [[UIImageView alloc] initWithImage:titleImage];
-        titleView.center = self.secondWindow.center;
-        [self.secondWindow addSubview:titleView];
-        [titleView release];
-        [self.secondWindow makeKeyAndVisible];
-    }
 }
 
 -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sun Feb 05 15:52:26 2012 +0100
@@ -21,7 +21,6 @@
 
 #import "ObjcExports.h"
 #import "OverlayViewController.h"
-#import "AmmoMenuViewController.h"
 
 
 // cache the grenade time
@@ -64,7 +63,7 @@
         overlay_instance.view.userInteractionEnabled = NO;
     }
     CGPoint center = overlay_instance.view.center;
-    CGPoint loaderCenter = ((IS_DUALHEAD() || [HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3));
+    CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3);
 
     overlay_instance.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
     overlay_instance.loadingIndicator.hidesWhenStopped = YES;
@@ -119,10 +118,6 @@
     grenadeTime = 2;
 }
 
-void updateVisualsNewTurn(void) {
-    [overlay_instance.amvc updateAmmoVisuals];
-}
-
 // dummy function to prevent linkage fail
 int SDL_main(int argc, char **argv) {
     return 0;
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Sun Feb 05 15:52:26 2012 +0100
@@ -23,7 +23,6 @@
 
 @class InGameMenuViewController;
 @class HelpPageViewController;
-@class AmmoMenuViewController;
 
 @interface OverlayViewController : UIViewController {
     // the timer that dims the overlay
@@ -36,17 +35,11 @@
 
     // the help menu
     HelpPageViewController *helpPage;
-
-    // the objc ammomenu
-    AmmoMenuViewController *amvc;
     
     // ths touch section
     CGFloat initialDistanceForPinching;
     CGPoint startingPoint;
     BOOL isAttacking;
-    
-    // dual head support
-    NSInteger initialScreenCount;
 
     // various other widgets
     UIActivityIndicatorView *loadingIndicator;
@@ -57,14 +50,10 @@
 @property (nonatomic,retain) id popoverController;
 @property (nonatomic,retain) InGameMenuViewController *popupMenu;
 @property (nonatomic,retain) HelpPageViewController *helpPage;
-@property (nonatomic,retain) AmmoMenuViewController *amvc;
 @property (nonatomic,retain) UIActivityIndicatorView *loadingIndicator;
 @property (nonatomic,retain) UIButton *confirmButton;
 @property (nonatomic,retain) UISegmentedControl *grenadeTimeSegment;
 
-@property (assign) NSInteger initialScreenCount;
-
-
 +(OverlayViewController *)mainOverlay;
 
 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sun Feb 05 15:52:26 2012 +0100
@@ -22,22 +22,20 @@
 #import "OverlayViewController.h"
 #import "InGameMenuViewController.h"
 #import "HelpPageViewController.h"
-#import "AmmoMenuViewController.h"
 #import "CGPointUtils.h"
 #import "ObjcExports.h"
 
 
 #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7]
 #define HIDING_TIME_NEVER   [NSDate dateWithTimeIntervalSinceNow:10000]
-#define doDim()             [dimTimer setFireDate: (IS_DUALHEAD()) ? HIDING_TIME_NEVER : HIDING_TIME_DEFAULT]
+#define doDim()             [dimTimer setFireDate:HIDING_TIME_DEFAULT]
 #define doNotDim()          [dimTimer setFireDate:HIDING_TIME_NEVER]
 
 
 static OverlayViewController *mainOverlay;
 
 @implementation OverlayViewController
-@synthesize popoverController, popupMenu, helpPage, amvc, initialScreenCount, loadingIndicator,
-            confirmButton, grenadeTimeSegment;
+@synthesize popoverController, popupMenu, helpPage, loadingIndicator, confirmButton, grenadeTimeSegment;
 
 #pragma mark -
 #pragma mark rotation
@@ -52,7 +50,6 @@
     if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
         isAttacking = NO;
         isPopoverVisible = NO;
-        initialScreenCount = (IS_DUALHEAD() ? 2 : 1);
         loadingIndicator = nil;
         mainOverlay = self;
     }
@@ -67,7 +64,7 @@
     // fill all the screen available as sdlview disables autoresizing
     self.view.frame = [[UIScreen mainScreen] safeBounds];
     // the timer used to dim the overlay
-    dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6]
+    dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6]
                                         interval:1000
                                           target:self
                                         selector:@selector(dimOverlay)
@@ -81,18 +78,6 @@
                                              selector:@selector(showHelp:)
                                                  name:@"show help ingame"
                                                object:nil];
-
-    if (IS_IPAD()) {
-        [[NSNotificationCenter defaultCenter] addObserver:self
-                                                 selector:@selector(numberOfScreensIncreased)
-                                                     name:UIScreenDidConnectNotification
-                                                   object:nil];
-        
-        [[NSNotificationCenter defaultCenter] addObserver:self
-                                                 selector:@selector(numberOfScreensDecreased)
-                                                     name:UIScreenDidDisconnectNotification
-                                                   object:nil];
-    }
     
     // present the overlay
     self.view.alpha = 0;
@@ -115,7 +100,6 @@
     self.helpPage = nil;
     [self dismissPopover];
     self.popoverController = nil;
-    self.amvc = nil;
     self.loadingIndicator = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
@@ -126,8 +110,6 @@
         self.popupMenu = nil;
     if (self.helpPage.view.superview == nil)
         self.helpPage = nil;
-    if (self.amvc.view.superview == nil)
-        self.amvc = nil;
     if (self.loadingIndicator.superview == nil)
         self.loadingIndicator = nil;
     if (self.confirmButton.superview == nil)
@@ -146,7 +128,6 @@
     releaseAndNil(popupMenu);
     releaseAndNil(helpPage);
     releaseAndNil(popoverController);
-    releaseAndNil(amvc);
     releaseAndNil(loadingIndicator);
     releaseAndNil(confirmButton);
     releaseAndNil(grenadeTimeSegment);
@@ -154,32 +135,6 @@
     [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 appearance
 // nice transition for dimming, should be called only by the timer himself
@@ -281,34 +236,14 @@
             break;
         case 10:
             [AudioManagerController playClickSound];
-            clearView();
             HW_pause();
-            if (self.amvc.isVisible && IS_DUALHEAD() == NO) {
-                doDim();
-                [self.amvc disappear];
-            }
             clearView();
             [self showPopover];
             break;
         case 11:
             [AudioManagerController playClickSound];
             clearView();
-            
-            if (IS_DUALHEAD() || [[[NSUserDefaults standardUserDefaults] objectForKey:@"classic_menu"] boolValue] == NO) {
-                if (self.amvc == nil)
-                    self.amvc = [[AmmoMenuViewController alloc] init];
-
-                if (self.amvc.isVisible) {
-                    doDim();
-                    [self.amvc disappear];
-                } else {
-                    if (HW_isAmmoMenuNotAllowed() == NO) {
-                        doNotDim();
-                        [self.amvc appearInView:self.view];
-                    }
-                }
-            } else
-                HW_ammoMenu();
+            HW_ammoMenu();
             break;
         default:
             DLog(@"Nope");
@@ -420,10 +355,6 @@
     if (isPopoverVisible)
         [self dismissPopover];
 
-    if (self.amvc.isVisible && IS_DUALHEAD() == NO) {
-        doDim();
-        [self.amvc disappear];
-    }
     // reset default dimming
     doDim();
 
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Feb 04 23:06:22 2012 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sun Feb 05 15:52:26 2012 +0100
@@ -235,7 +235,6 @@
 		61D0BDF91457508C0011A899 /* ExtraCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D0BDF81457508C0011A899 /* ExtraCategories.m */; };
 		61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D205A0127CDD1100ABD83E /* ObjcExports.m */; };
 		61D3D2A51290E03A003CE7C3 /* irc.png in Resources */ = {isa = PBXBuildFile; fileRef = 61D3D2A41290E03A003CE7C3 /* irc.png */; };
-		61DE8F221257EB1100B80214 /* AmmoMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */; };
 		61DF0EDC1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */; };
 		61DF0F211284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */; };
 		61E1F4F811D004240016A5AA /* adler32.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61E1F4F711D004240016A5AA /* adler32.pas */; };
@@ -649,8 +648,6 @@
 		61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = "<group>"; };
 		61D205A0127CDD1100ABD83E /* ObjcExports.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcExports.m; path = Classes/ObjcExports.m; sourceTree = "<group>"; };
 		61D3D2A41290E03A003CE7C3 /* irc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = irc.png; path = Resources/Icons/irc.png; sourceTree = "<group>"; };
-		61DE8F201257EB1100B80214 /* AmmoMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AmmoMenuViewController.h; sourceTree = "<group>"; };
-		61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AmmoMenuViewController.m; sourceTree = "<group>"; };
 		61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageLobbyViewController-iPhone.xib"; sourceTree = "<group>"; };
 		61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageInGameViewController-iPhone.xib"; sourceTree = "<group>"; };
 		61E1F4F711D004240016A5AA /* adler32.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = adler32.pas; path = ../../hedgewars/adler32.pas; sourceTree = SOURCE_ROOT; };
@@ -967,8 +964,6 @@
 		6163EE6C11CC253F001C0453 /* Overlay */ = {
 			isa = PBXGroup;
 			children = (
-				61DE8F201257EB1100B80214 /* AmmoMenuViewController.h */,
-				61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */,
 				616591F811CA9BA200D6E256 /* InGameMenuViewController.h */,
 				616591F911CA9BA200D6E256 /* InGameMenuViewController.m */,
 				616591F611CA9BA200D6E256 /* OverlayViewController.h */,
@@ -1701,7 +1696,6 @@
 				611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */,
 				619C5AF4124F7E3100D041AE /* LuaPas.pas in Sources */,
 				619C5BA2124FA59000D041AE /* MapPreviewButtonView.m in Sources */,
-				61DE8F221257EB1100B80214 /* AmmoMenuViewController.m in Sources */,
 				61399013125D19C0003C2DC0 /* uMobile.pas in Sources */,
 				61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */,
 				61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */,