# HG changeset patch # User koda # Date 1276799439 -7200 # Node ID 59dbd31e9953d2b66dbc8c4f77149ea2f14df891 # Parent f589230fa21b3763f8266b041683ea1941c05a78 move stuff around and update iphone project diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/DetailViewController.h --- a/cocoaTouch/DetailViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -// -// DetailViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class GeneralSettingsViewController; -@class TeamSettingsViewController; -@class WeaponSettingsViewController; -@class SchemeSettingsViewController; - -@interface DetailViewController : UITableViewController -#if __IPHONE_3_2 - -#endif -{ - NSArray *controllerNames; - - GeneralSettingsViewController *generalSettingsViewController; - TeamSettingsViewController *teamSettingsViewController; - WeaponSettingsViewController *weaponSettingsViewController; - SchemeSettingsViewController *schemeSettingsViewController; - UIPopoverController *popoverController; -} - -// used in iphone version --(IBAction) dismissSplitView; - -@property (nonatomic, retain) NSArray *controllerNames; -@property (nonatomic,retain) UIPopoverController *popoverController; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/DetailViewController.m --- a/cocoaTouch/DetailViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ - // -// DetailViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "DetailViewController.h" -#import "SDL_uikitappdelegate.h" -#import "GeneralSettingsViewController.h" -#import "TeamSettingsViewController.h" -#import "WeaponSettingsViewController.h" -#import "SchemeSettingsViewController.h" -#import "CommodityFunctions.h" - -@implementation DetailViewController -@synthesize controllerNames,popoverController; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ - self.view.frame = CGRectMake(0, 0, 1024, 1024); -} - --(void) viewDidLoad { - self.title = NSLocalizedString(@"Settings",@""); - - // allocate controllers and store them into the array - NSArray *array= [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), - NSLocalizedString(@"Teams",@""), - NSLocalizedString(@"Weapons",@""), - NSLocalizedString(@"Schemes",@""), - nil]; - self.controllerNames = array; - [array release]; - - // on ipad make the general setting the first view, on iphone add the "Done" button on top left - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(112, 112, 480, 320)]; - label.text = @"Press the buttons on the left"; - label.font = [UIFont systemFontOfSize:20]; - label.textAlignment = UITextAlignmentCenter; - [self.view addSubview:label]; - [label release]; - - //[self.navigationController pushViewController:nextController animated:NO]; - } else { - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(dismissSplitView)]; - } - - [super viewDidLoad]; -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - // don't display - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - return 0; - else - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [controllerNames count]; -} - --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier] autorelease]; - } - - NSInteger row = [indexPath row]; - - cell.textLabel.text = [controllerNames objectAtIndex:row]; - cell.imageView.image = [UIImage imageNamed:@"Icon.png"]; - cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - - return cell; -} - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSInteger row = [indexPath row]; - UIViewController *nextController = nil; - - switch (row) { - case 0: - if (nil == generalSettingsViewController) - generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = generalSettingsViewController; - break; - case 1: - if (nil == teamSettingsViewController) - teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = teamSettingsViewController; - break; - case 2: - if (nil == weaponSettingsViewController) - weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = weaponSettingsViewController; - break; - case 3: - if (nil == schemeSettingsViewController) - schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = schemeSettingsViewController; - break; - } - - nextController.title = [controllerNames objectAtIndex:row]; - [self.navigationController pushViewController:nextController animated:YES]; -} - --(IBAction) dismissSplitView { - [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; -} - -#if __IPHONE_3_2 -#pragma mark - -#pragma mark splitview support --(void) splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController { - if (popoverController != nil) { - [popoverController dismissPopoverAnimated:YES]; - } -} - -// Called when the master view controller is about to be hidden --(void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController - withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc { - - /* barButtonItem.title = @"Master View"; - UIToolbar *toolbar = self.parentViewController.navigationController.toolbar; - NSMutableArray *items = [[toolbar items] mutableCopy]; - [items insertObject:barButtonItem atIndex:0]; - [toolbar setItems:items animated:YES]; - - [items release]; - - self.popoverController = pc;*/ - barButtonItem.title = aViewController.title; - self.navigationItem.rightBarButtonItem = barButtonItem; -} - -// Called when the master view controller is about to appear --(void) splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController - invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { - /*UIToolbar *toolbar = self.parentViewController.navigationController.toolbar; - - NSMutableArray *items = [[toolbar items] mutableCopy]; - [items removeObjectAtIndex:0]; - - [toolbar setItems:items animated:YES]; - - [items release]; - - self.popoverController = nil;*/ - self.navigationItem.rightBarButtonItem = nil; - -} -#endif - --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Release any cached data, images, etc that aren't in use. - if (generalSettingsViewController.view.superview == nil) - generalSettingsViewController = nil; - if (teamSettingsViewController.view.superview == nil) - teamSettingsViewController = nil; - if (weaponSettingsViewController.view.superview == nil) - weaponSettingsViewController = nil; - if (schemeSettingsViewController.view.superview == nil) - schemeSettingsViewController = nil; - MSG_MEMCLEAN(); -} - --(void) viewDidUnload { - self.controllerNames = nil; - generalSettingsViewController = nil; - teamSettingsViewController = nil; - weaponSettingsViewController = nil; - schemeSettingsViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [controllerNames release]; - [generalSettingsViewController release]; - [teamSettingsViewController release]; - [weaponSettingsViewController release]; - [schemeSettingsViewController release]; - [super dealloc]; -} -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/FlagsViewController.h --- a/cocoaTouch/FlagsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// -// FlagsViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface FlagsViewController : UITableViewController { - NSDictionary *teamDictionary; - - NSArray *flagArray; - NSIndexPath *lastIndexPath; -} - -@property (nonatomic,retain) NSDictionary * teamDictionary; -@property (nonatomic,retain) NSArray *flagArray; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/FlagsViewController.m --- a/cocoaTouch/FlagsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -// -// FlagsViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "FlagsViewController.h" -#import "CommodityFunctions.h" - -@implementation FlagsViewController -@synthesize teamDictionary, flagArray, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - self.flagArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL]; -} - --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self.tableView reloadData]; - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [flagArray count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - NSString *flag = [flagArray objectAtIndex:[indexPath row]]; - - NSString *flagFile = [[NSString alloc] initWithFormat:@"%@/%@", FLAGS_DIRECTORY(), flag]; - UIImage *flagSprite = [[UIImage alloc] initWithContentsOfFile:flagFile]; - [flagFile release]; - cell.imageView.image = flagSprite; - [flagSprite release]; - - cell.textLabel.text = [flag stringByDeletingPathExtension]; - if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"flag"]]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - // if the two selected rows differ update data on the hog dictionary and reload table content - [self.teamDictionary setValue:[[flagArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"flag"]; - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - self.lastIndexPath = indexPath; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.teamDictionary = nil; - self.lastIndexPath = nil; - self.flagArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [teamDictionary release]; - [lastIndexPath release]; - [flagArray release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/FortsViewController.h --- a/cocoaTouch/FortsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// -// FortsViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface FortsViewController : UITableViewController { - NSDictionary *teamDictionary; - - NSArray *fortArray; - NSIndexPath *lastIndexPath; -} - -@property (nonatomic,retain) NSDictionary * teamDictionary; -@property (nonatomic,retain) NSArray *fortArray; -//@property (nonatomic,retain) NSArray *fortSprites; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/FortsViewController.m --- a/cocoaTouch/FortsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -// -// FortsViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "FortsViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation FortsViewController -@synthesize teamDictionary, fortArray, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FORTS_DIRECTORY() error:NULL]; - NSMutableArray *filteredContents = [[NSMutableArray alloc] initWithCapacity:([directoryContents count] / 2)]; - // we need to remove the double entries and the L.png suffix - for (int i = 0; i < [directoryContents count]; i++) { - if (i % 2) { - NSString *currentName = [directoryContents objectAtIndex:i]; - NSString *correctName = [currentName substringToIndex:([currentName length] - 5)]; - [filteredContents addObject:correctName]; - } - } - self.fortArray = filteredContents; - [filteredContents release]; - - /* - // this creates a scaled down version of the image - NSMutableArray *spriteArray = [[NSMutableArray alloc] initWithCapacity:[fortArray count]]; - for (NSString *fortName in fortArray) { - NSString *fortFile = [[NSString alloc] initWithFormat:@"%@/%@L.png", fortsDirectory, fortName]; - UIImage *fortSprite = [[UIImage alloc] initWithContentsOfFile:fortFile]; - [fortFile release]; - [spriteArray addObject:[fortSprite scaleToSize:CGSizeMake(196,196)]]; - [fortSprite release]; - } - self.fortSprites = spriteArray; - [spriteArray release]; - */ - - // statically set row height instead of using delegate method for performance reasons - self.tableView.rowHeight = 200; -} - - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self.tableView reloadData]; - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.fortArray count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle - reuseIdentifier:CellIdentifier] autorelease]; - } - - NSString *fortName = [fortArray objectAtIndex:[indexPath row]]; - cell.textLabel.text = fortName; - - // this creates a scaled down version of the image - // TODO: create preview files, scaling is way too slow! - NSString *fortFile = [[NSString alloc] initWithFormat:@"%@/%@L.png", FORTS_DIRECTORY(), fortName]; - UIImage *fortSprite = [[UIImage alloc] initWithContentsOfFile:fortFile]; - [fortFile release]; - cell.imageView.image = [fortSprite scaleToSize:CGSizeMake(196,196)]; - [fortSprite release]; - - cell.detailTextLabel.text = @"Insert funny description here"; - if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"fort"]]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - // if the two selected rows differ update data on the hog dictionary and reload table content - [self.teamDictionary setValue:[fortArray objectAtIndex:newRow] forKey:@"fort"]; - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - self.lastIndexPath = indexPath; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.teamDictionary = nil; - self.lastIndexPath = nil; - self.fortArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - - -- (void)dealloc { - [teamDictionary release]; - [lastIndexPath release]; - [fortArray release]; -// [fortSprites release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GameConfigViewController.h --- a/cocoaTouch/GameConfigViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// -// GameConfigViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 18/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class TeamConfigViewController; -@class MapConfigViewController; -@class SchemeWeaponConfigViewController; - -@interface GameConfigViewController : UIViewController { - UIViewController *activeController; - MapConfigViewController *mapConfigViewController; - TeamConfigViewController *teamConfigViewController; - SchemeWeaponConfigViewController *schemeWeaponConfigViewController; -} - --(IBAction) buttonPressed:(id) sender; --(IBAction) segmentPressed:(id) sender; --(void) startGame; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GameConfigViewController.m --- a/cocoaTouch/GameConfigViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ - // -// GameConfigViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 18/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "GameConfigViewController.h" -#import "SDL_uikitappdelegate.h" -#import "CommodityFunctions.h" -#import "MapConfigViewController.h" -#import "TeamConfigViewController.h" -#import "SchemeWeaponConfigViewController.h" - -@implementation GameConfigViewController - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(IBAction) buttonPressed:(id) sender { - // works even if it's not actually a button - UIButton *theButton = (UIButton *)sender; - switch (theButton.tag) { - case 0: - [[self parentViewController] dismissModalViewControllerAnimated:YES]; - break; - case 1: - [self performSelector:@selector(startGame) - withObject:nil - afterDelay:0.25]; - break; - default: - break; - } -} - --(IBAction) segmentPressed:(id) sender { - UISegmentedControl *theSegment = (UISegmentedControl *)sender; - - switch (theSegment.selectedSegmentIndex) { - case 0: - // this init here is just aestetic as this controller was already set up in viewDidLoad - if (mapConfigViewController == nil) { - mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - } - activeController = mapConfigViewController; - break; - case 1: - if (teamConfigViewController == nil) { - teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - // this message is compulsory otherwise the table won't be loaded at all - } - activeController = teamConfigViewController; - break; - case 2: - if (schemeWeaponConfigViewController == nil) { - schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - } - activeController = schemeWeaponConfigViewController; - break; - } - - // this message is compulsory otherwise the table won't be loaded at all - [activeController viewWillAppear:NO]; - [self.view addSubview:activeController.view]; -} - --(void) startGame { - // don't start playing if the preview is in progress - if ([mapConfigViewController busy]) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"") - message:NSLocalizedString(@"Before playing the preview needs to be generated",@"") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") - otherButtonTitles:nil]; - [alert show]; - [alert release]; - return; - } - - // play only if there is more than one team - if ([teamConfigViewController.listOfSelectedTeams count] < 2) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"") - message:NSLocalizedString(@"You need to select at least two teams to play a game",@"") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") - otherButtonTitles:nil]; - [alert show]; - [alert release]; - return; - } - - // play if there's room for enough hogs in the selected map - int hogs = 0; - for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams) - hogs += [[teamData objectForKey:@"number"] intValue]; - - if (hogs > mapConfigViewController.maxHogs) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"") - message:NSLocalizedString(@"The map you selected is too small for that many hogs",@"") - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") - otherButtonTitles:nil]; - [alert show]; - [alert release]; - return; - } - - // create the configuration file that is going to be sent to engine - NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command", - mapConfigViewController.templateFilterCommand,@"templatefilter_command", - mapConfigViewController.mapGenCommand,@"mapgen_command", - mapConfigViewController.mazeSizeCommand,@"mazesize_command", - mapConfigViewController.themeCommand,@"theme_command", - teamConfigViewController.listOfSelectedTeams,@"teams_list", - schemeWeaponConfigViewController.selectedScheme,@"scheme", - schemeWeaponConfigViewController.selectedWeapon,@"weapon", - nil]; - [dict writeToFile:GAMECONFIG_FILE() atomically:YES]; - [dict release]; - - // finally launch game and remove this controller - [[self parentViewController] dismissModalViewControllerAnimated:YES]; - [[SDLUIKitDelegate sharedAppDelegate] startSDLgame]; -} - --(void) viewDidLoad { - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - if (mapConfigViewController == nil) - mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; - if (teamConfigViewController == nil) - teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStylePlain]; - teamConfigViewController.view.frame = CGRectMake(0, 224, 300, 500); - teamConfigViewController.view.backgroundColor = [UIColor clearColor]; - [mapConfigViewController.view addSubview:teamConfigViewController.view]; - if (schemeWeaponConfigViewController == nil) - schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - schemeWeaponConfigViewController.view.frame = CGRectMake(362, 224, 300, 500); - schemeWeaponConfigViewController.view.backgroundColor = [UIColor clearColor]; - [mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; - } else - mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - activeController = mapConfigViewController; - - [self.view addSubview:mapConfigViewController.view]; - - [super viewDidLoad]; -} - --(void) viewWillAppear:(BOOL)animated { - [mapConfigViewController viewWillAppear:animated]; - [teamConfigViewController viewWillAppear:animated]; - [schemeWeaponConfigViewController viewWillAppear:animated]; - // ADD other controllers here - - [super viewWillAppear:animated]; -} - --(void) viewDidAppear:(BOOL)animated { - [mapConfigViewController viewDidAppear:animated]; - [teamConfigViewController viewDidAppear:animated]; - [schemeWeaponConfigViewController viewDidAppear:animated]; - [super viewDidAppear:animated]; -} - --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Release any cached data, images, etc that aren't in use. - if (mapConfigViewController.view.superview == nil) - mapConfigViewController = nil; - if (teamConfigViewController.view.superview == nil) - teamConfigViewController = nil; - if (schemeWeaponConfigViewController.view.superview == nil) - schemeWeaponConfigViewController = nil; - activeController = nil; - MSG_MEMCLEAN(); -} - --(void) viewDidUnload { - activeController = nil; - mapConfigViewController = nil; - teamConfigViewController = nil; - schemeWeaponConfigViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [activeController release]; - [mapConfigViewController release]; - [teamConfigViewController release]; - [schemeWeaponConfigViewController release]; - [super dealloc]; -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GameSetup.h --- a/cocoaTouch/GameSetup.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// -// gameSetup.h -// hwengine -// -// Created by Vittorio on 10/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import -#import "SDL_net.h" - -@interface GameSetup : NSObject { - NSDictionary *systemSettings; - NSDictionary *gameConfig; - - NSInteger ipcPort; - TCPsocket sd, csd; // Socket descriptor, Client socket descriptor -} - -@property (nonatomic, retain) NSDictionary *systemSettings; -@property (nonatomic, retain) NSDictionary *gameConfig; - --(void) engineProtocol; --(void) startThread:(NSString *)selector; --(int) sendToEngine:(NSString *)string; --(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor; --(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams; --(NSInteger) provideScheme:(NSString *)schemeName; - --(const char **)getSettings; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GameSetup.m --- a/cocoaTouch/GameSetup.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,450 +0,0 @@ -// -// gameSetup.m -// hwengine -// -// Created by Vittorio on 10/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#include -#include - -#import "GameSetup.h" -#import "SDL_uikitappdelegate.h" -#import "SDL_net.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" - -#define BUFFER_SIZE 256 -#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]); - -@implementation GameSetup - -@synthesize systemSettings, gameConfig; - --(id) init { - if (self = [super init]) { - ipcPort = randomPort(); - - // should check they exist and throw and exection if not - NSDictionary *dictSett = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; - self.systemSettings = dictSett; - [dictSett release]; - - NSDictionary *dictGame = [[NSDictionary alloc] initWithContentsOfFile:GAMECONFIG_FILE()]; - self.gameConfig = dictGame; - [dictGame release]; - } - return self; -} - --(NSString *)description { - return [NSString stringWithFormat:@"ipcport: %d\nsockets: %d,%d\n teams: %@\n systemSettings: %@",ipcPort,sd,csd,gameConfig,systemSettings]; -} - --(void) dealloc { - [gameConfig release]; - [systemSettings release]; - [super dealloc]; -} - -#pragma mark - -#pragma mark Provider functions -// unpacks team data from the selected team.plist to a sequence of engine commands --(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor { - /* - addteam <32charsMD5hash> - addhh - is 0 for human, 1-5 for bots (5 is the most stupid) - */ - - NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@", TEAMS_DIRECTORY(), teamName]; - NSDictionary *teamData = [[NSDictionary alloc] initWithContentsOfFile:teamFile]; - [teamFile release]; - - NSString *teamHashColorAndName = [[NSString alloc] initWithFormat:@"eaddteam %@ %@ %@", - [teamData objectForKey:@"hash"], [teamColor stringValue], [teamData objectForKey:@"teamname"]]; - [self sendToEngine: teamHashColorAndName]; - [teamHashColorAndName release]; - - NSString *grave = [[NSString alloc] initWithFormat:@"egrave %@", [teamData objectForKey:@"grave"]]; - [self sendToEngine: grave]; - [grave release]; - - NSString *fort = [[NSString alloc] initWithFormat:@"efort %@", [teamData objectForKey:@"fort"]]; - [self sendToEngine: fort]; - [fort release]; - - NSString *voicepack = [[NSString alloc] initWithFormat:@"evoicepack %@", [teamData objectForKey:@"voicepack"]]; - [self sendToEngine: voicepack]; - [voicepack release]; - - NSString *flag = [[NSString alloc] initWithFormat:@"eflag %@", [teamData objectForKey:@"flag"]]; - [self sendToEngine: flag]; - [flag release]; - - NSArray *hogs = [teamData objectForKey:@"hedgehogs"]; - for (int i = 0; i < numberOfPlayingHogs; i++) { - NSDictionary *hog = [hogs objectAtIndex:i]; - - NSString *hogLevelHealthAndName = [[NSString alloc] initWithFormat:@"eaddhh %@ %d %@", - [hog objectForKey:@"level"], initialHealth, [hog objectForKey:@"hogname"]]; - [self sendToEngine: hogLevelHealthAndName]; - [hogLevelHealthAndName release]; - - NSString *hogHat = [[NSString alloc] initWithFormat:@"ehat %@", [hog objectForKey:@"hat"]]; - [self sendToEngine: hogHat]; - [hogHat release]; - } - - [teamData release]; -} - -// unpacks ammostore data from the selected ammo.plist to a sequence of engine commands --(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams { - - //NSDictionary *ammoData = [[NSDictionary alloc] initWithContentsOfFile:ammoDataFile]; - NSDictionary *ammoData = [[NSDictionary alloc] initWithObjectsAndKeys: - @"9391929422199121032235111001201000000211190911",@"ammostore_initialqt", - @"0405040541600655546554464776576666666155501000",@"ammostore_probability", - @"0000000000000205500000040007004000000000200000",@"ammostore_delay", - @"1311110312111111123114111111111111111211101111",@"ammostore_crate", nil]; - - - NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@", [ammoData objectForKey:@"ammostore_initialqt"]]; - [self sendToEngine: ammloadt]; - [ammloadt release]; - - NSString *ammprob = [[NSString alloc] initWithFormat:@"eammprob %@", [ammoData objectForKey:@"ammostore_probability"]]; - [self sendToEngine: ammprob]; - [ammprob release]; - - NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammdelay %@", [ammoData objectForKey:@"ammostore_delay"]]; - [self sendToEngine: ammdelay]; - [ammdelay release]; - - NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@", [ammoData objectForKey:@"ammostore_crate"]]; - [self sendToEngine: ammreinf]; - [ammreinf release]; - - // sent twice so it applies to both teams - NSString *ammstore = [[NSString alloc] initWithString:@"eammstore"]; - for (int i = 0; i < numberOfTeams; i++) - [self sendToEngine: ammstore]; - [ammstore release]; - - [ammoData release]; -} - -// unpacks scheme data from the selected scheme.plist to a sequence of engine commands --(NSInteger) provideScheme:(NSString *)schemeName { - NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),schemeName]; - NSArray *scheme = [[NSArray alloc] initWithContentsOfFile:schemePath]; - [schemePath release]; - int result = 0; - int i = 0; - - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x01; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x10; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x04; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x08; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x20; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x40; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x80; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x100; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x200; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x400; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x800; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x2000; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x4000; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x8000; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x10000; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x20000; - if ([[scheme objectAtIndex:i++] boolValue]) - result |= 0x80000; - - NSString *flags = [[NSString alloc] initWithFormat:@"e$gmflags %d",result]; - [self sendToEngine:flags]; - [flags release]; - - NSString *dmgMod = [[NSString alloc] initWithFormat:@"e$damagepct %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:dmgMod]; - [dmgMod release]; - - NSString *turnTime = [[NSString alloc] initWithFormat:@"e$turntime %d",[[scheme objectAtIndex:i++] intValue] * 1000]; - [self sendToEngine:turnTime]; - [turnTime release]; - - result = [[scheme objectAtIndex:i++] intValue]; // initial health - - NSString *sdTime = [[NSString alloc] initWithFormat:@"e$sd_turns %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:sdTime]; - [sdTime release]; - - NSString *crateDrops = [[NSString alloc] initWithFormat:@"e$casefreq %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:crateDrops]; - [crateDrops release]; - - NSString *minesTime = [[NSString alloc] initWithFormat:@"e$minestime %d",[[scheme objectAtIndex:i++] intValue] * 1000]; - [self sendToEngine:minesTime]; - [minesTime release]; - - NSString *minesNumber = [[NSString alloc] initWithFormat:@"e$landadds %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:minesNumber]; - [minesNumber release]; - - NSString *dudMines = [[NSString alloc] initWithFormat:@"e$minedudpct %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:dudMines]; - [dudMines release]; - - NSString *explosives = [[NSString alloc] initWithFormat:@"e$explosives %d",[[scheme objectAtIndex:i++] intValue]]; - [self sendToEngine:explosives]; - [explosives release]; - - [scheme release]; - return result; -} - -#pragma mark - -#pragma mark Thread/Network relevant code -// select one of GameSetup method and execute it in a seprate thread --(void) startThread: (NSString *) selector { - SEL usage = NSSelectorFromString(selector); - [NSThread detachNewThreadSelector:usage toTarget:self withObject:nil]; -} - -// wrapper that computes the length of the message and then sends the command string --(int) sendToEngine: (NSString *)string { - uint8_t length = [string length]; - - SDLNet_TCP_Send(csd, &length , 1); - return SDLNet_TCP_Send(csd, [string UTF8String], length); -} - -// method that handles net setup with engine and keeps connection alive --(void) engineProtocol { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - IPaddress ip; - int eProto; - BOOL clientQuit, serverQuit; - char buffer[BUFFER_SIZE], string[BUFFER_SIZE]; - uint8_t msgSize; - uint16_t gameTicks; - - serverQuit = NO; - - if (SDLNet_Init() < 0) { - NSLog(@"SDLNet_Init: %s", SDLNet_GetError()); - serverQuit = YES; - } - - // Resolving the host using NULL make network interface to listen - if (SDLNet_ResolveHost(&ip, NULL, ipcPort) < 0) { - NSLog(@"SDLNet_ResolveHost: %s\n", SDLNet_GetError()); - serverQuit = YES; - } - - // Open a connection with the IP provided (listen on the host's port) - if (!(sd = SDLNet_TCP_Open(&ip))) { - NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), ipcPort); - serverQuit = YES; - } - - NSLog(@"engineProtocol - Waiting for a client on port %d", ipcPort); - while (!serverQuit) { - // This check the sd if there is a pending connection. - // If there is one, accept that, and open a new socket for communicating - csd = SDLNet_TCP_Accept(sd); - if (NULL != csd) { - // Now we can communicate with the client using csd socket - // sd will remain opened waiting other connections - NSLog(@"engineProtocol - Client found"); - - //first byte of the command alwayas contain the size of the command - SDLNet_TCP_Recv(csd, &msgSize, sizeof(uint8_t)); - - SDLNet_TCP_Recv(csd, buffer, msgSize); - gameTicks = SDLNet_Read16 (&buffer[msgSize - 2]); - //NSLog(@"engineProtocol - %d: received [%s]", gameTicks, buffer); - - if ('C' == buffer[0]) { - NSLog(@"engineProtocol - sending game config"); - - // local game - [self sendToEngine:@"TL"]; - - // seed info - [self sendToEngine:[self.gameConfig objectForKey:@"seed_command"]]; - - // scheme (returns initial health) - NSInteger health = [self provideScheme:[self.gameConfig objectForKey:@"scheme"]]; - - // dimension of the map - [self sendToEngine:[self.gameConfig objectForKey:@"templatefilter_command"]]; - [self sendToEngine:[self.gameConfig objectForKey:@"mapgen_command"]]; - [self sendToEngine:[self.gameConfig objectForKey:@"mazesize_command"]]; - - // theme info - [self sendToEngine:[self.gameConfig objectForKey:@"theme_command"]]; - - NSArray *teamsConfig = [self.gameConfig objectForKey:@"teams_list"]; - for (NSDictionary *teamData in teamsConfig) { - [self provideTeamData:[teamData objectForKey:@"team"] - forHogs:[[teamData objectForKey:@"number"] intValue] - withHealth:health - ofColor:[teamData objectForKey:@"color"]]; - } - - [self provideAmmoData:nil forPlayingTeams:[teamsConfig count]]; - - clientQuit = NO; - } else { - NSLog(@"engineProtocolThread - wrong message or client closed connection"); - clientQuit = YES; - } - - while (!clientQuit){ - msgSize = 0; - memset(buffer, 0, BUFFER_SIZE); - memset(string, 0, BUFFER_SIZE); - if (SDLNet_TCP_Recv(csd, &msgSize, sizeof(uint8_t)) <= 0) - clientQuit = YES; - if (SDLNet_TCP_Recv(csd, buffer, msgSize) <=0) - clientQuit = YES; - - gameTicks = SDLNet_Read16(&buffer[msgSize - 2]); - //NSLog(@"engineProtocolThread - %d: received [%s]", gameTicks, buffer); - - switch (buffer[0]) { - case '?': - NSLog(@"Ping? Pong!"); - [self sendToEngine:@"!"]; - break; - case 'E': - NSLog(@"ERROR - last console line: [%s]", buffer); - clientQuit = YES; - break; - case 'e': - sscanf(buffer, "%*s %d", &eProto); - short int netProto = 0; - char *versionStr; - - HW_versionInfo(&netProto, &versionStr); - if (netProto == eProto) { - NSLog(@"Setting protocol version %d (%s)", eProto, versionStr); - } else { - NSLog(@"ERROR - wrong protocol number: [%s] - expecting %d", buffer, eProto); - clientQuit = YES; - } - - break; - case 'i': - switch (buffer[1]) { - case 'r': - NSLog(@"Winning team: %s", &buffer[2]); - break; - case 'k': - NSLog(@"Best Hedgehog: %s", &buffer[2]); - break; - } - break; - default: - // empty packet or just statistics - break; - // missing case for exiting right away - } - } - NSLog(@"Engine exited, closing server"); - // wait a little to let the client close cleanly - [NSThread sleepForTimeInterval:2]; - // Close the client socket - SDLNet_TCP_Close(csd); - serverQuit = YES; - } - } - - SDLNet_TCP_Close(sd); - SDLNet_Quit(); - - [[NSFileManager defaultManager] removeItemAtPath:GAMECONFIG_FILE() error:NULL]; - - [pool release]; - //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution. - //[NSThread exit]; -} - -#pragma mark - -#pragma mark Setting methods -// returns an array of c-strings that are read by engine at startup --(const char **)getSettings { - NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; - NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - 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 *) * 9); - - /* - 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); - char *name = malloc(size); - // Get the platform name - sysctlbyname("hw.machine", name, &size, NULL, 0); - NSString *machine = [[NSString alloc] initWithUTF8String:name]; - free(name); - - const char **gameArgs = (const char**) malloc(sizeof(char*) * 9); - - // if the machine is less than iphone 3gs or less than ipod touch 3g use reduced graphics (land array) - if ([machine hasPrefix:@"iPhone1"] || ([machine hasPrefix:@"iPod"] && ([machine hasSuffix:@"1,1"] || [machine hasSuffix:@"2,1"]))) - gameArgs[8] = "1"; - else - gameArgs[8] = "0"; - [machine release]; - */ - - // prevents using an empty nickname - NSString *username; - NSString *originalUsername = [self.systemSettings objectForKey:@"username"]; - if ([originalUsername length] == 0) - username = [[NSString alloc] initWithFormat:@"MobileUser-%@",ipcString]; - else - username = [[NSString alloc] initWithString:originalUsername]; - - gameArgs[0] = [username UTF8String]; //UserNick - gameArgs[1] = [ipcString UTF8String]; //ipcPort - gameArgs[2] = [[[self.systemSettings objectForKey:@"sound"] stringValue] UTF8String]; //isSoundEnabled - gameArgs[3] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String]; //isMusicEnabled - gameArgs[4] = [localeString UTF8String]; //cLocaleFName - gameArgs[5] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String]; //cAltDamage - gameArgs[6] = [wSize UTF8String]; //cScreenHeight - gameArgs[7] = [hSize UTF8String]; //cScreenWidth - gameArgs[8] = NULL; //recordFileName - - [wSize release]; - [hSize release]; - [localeString release]; - [ipcString release]; - [username release]; - return gameArgs; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GeneralSettingsViewController.h --- a/cocoaTouch/GeneralSettingsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -// -// SettingsViewController.h -// hwengine -// -// Created by Vittorio on 08/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface GeneralSettingsViewController : UITableViewController { - NSMutableDictionary *settingsDictionary; - UITextField *textFieldBeingEdited; - UISwitch *musicSwitch; - UISwitch *soundSwitch; - UISwitch *altDamageSwitch; - BOOL isWriteNeeded; -} - -@property (nonatomic, retain) NSMutableDictionary *settingsDictionary; -@property (nonatomic, retain) UITextField *textFieldBeingEdited;; -@property (nonatomic, retain) UISwitch *musicSwitch; -@property (nonatomic, retain) UISwitch *soundSwitch; -@property (nonatomic, retain) UISwitch *altDamageSwitch; - -#define kNetworkFields 0 -#define kAudioFields 1 -#define kOtherFields 2 - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GeneralSettingsViewController.m --- a/cocoaTouch/GeneralSettingsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,398 +0,0 @@ -// -// SettingsViewController.m -// hwengine -// -// Created by Vittorio on 08/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "GeneralSettingsViewController.h" -#import "CommodityFunctions.h" - -@implementation GeneralSettingsViewController -@synthesize settingsDictionary, textFieldBeingEdited, musicSwitch, soundSwitch, altDamageSwitch; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark textfield methods -// return to previous table --(void) cancel:(id) sender { - if (textFieldBeingEdited != nil) - [self.textFieldBeingEdited resignFirstResponder]; -} - -// set the new value --(BOOL) save:(id) sender { - if (textFieldBeingEdited != nil) { - if (textFieldBeingEdited.tag == 0) { - [self.settingsDictionary setObject:textFieldBeingEdited.text forKey:@"username"]; - } else { - [self.settingsDictionary setObject:textFieldBeingEdited.text forKey:@"password"]; - } - - isWriteNeeded = YES; - [self.textFieldBeingEdited resignFirstResponder]; - return YES; - } - return NO; -} - -// the textfield is being modified, update the navigation controller --(void) textFieldDidBeginEditing:(UITextField *)aTextField{ - self.textFieldBeingEdited = aTextField; - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from the settings table") - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancel:)]; - self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; - - UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from the settings table") - style:UIBarButtonItemStyleDone - target:self - action:@selector(save:)]; - self.navigationItem.rightBarButtonItem = saveButton; - [saveButton release]; -} - -// the textfield has been modified, check for empty strings and restore original navigation bar --(void) textFieldDidEndEditing:(UITextField *)aTextField{ - self.textFieldBeingEdited = nil; - self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; - self.navigationItem.leftBarButtonItem = nil; -} - -// limit the size of the field to 64 characters like in original frontend --(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - int limit = 64; - return !([textField.text length] > limit && [string length] > range.length); -} - - -#pragma mark - -#pragma mark View Lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - self.musicSwitch = [[UISwitch alloc] init]; - self.soundSwitch = [[UISwitch alloc] init]; - self.altDamageSwitch = [[UISwitch alloc] init]; - [self.soundSwitch addTarget:self action:@selector(alsoTurnOffMusic:) forControlEvents:UIControlEventValueChanged]; - [self.musicSwitch addTarget:self action:@selector(dontTurnOnMusic:) forControlEvents:UIControlEventValueChanged]; - [self.altDamageSwitch addTarget:self action:@selector(justUpdateDictionary:) forControlEvents:UIControlEventValueChanged]; - - NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; - self.settingsDictionary = dictionary; - [dictionary release]; -} - --(void) viewWillAppear:(BOOL)animated { - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; - isWriteNeeded = NO; - - musicSwitch.on = [[settingsDictionary objectForKey:@"music"] boolValue]; - soundSwitch.on = [[settingsDictionary objectForKey:@"sound"] boolValue]; - altDamageSwitch.on = [[settingsDictionary objectForKey:@"alternate"] boolValue]; - - [super viewWillAppear:animated]; -} - --(void) viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - - if (isWriteNeeded) { - NSLog(@"writing preferences to file"); - [self.settingsDictionary writeToFile:SETTINGS_FILE() atomically:YES]; - isWriteNeeded = NO; - } -} - -#pragma mark - -// if the sound system is off, turn off also the background music --(void) alsoTurnOffMusic:(id) sender { - [self.settingsDictionary setObject:[NSNumber numberWithBool:soundSwitch.on] forKey:@"sound"]; - if (YES == self.musicSwitch.on) { - [musicSwitch setOn:NO animated:YES]; - [self.settingsDictionary setObject:[NSNumber numberWithBool:musicSwitch.on] forKey:@"music"]; - } - isWriteNeeded = YES; -} - -// if the sound system is off, don't enable background music --(void) dontTurnOnMusic:(id) sender { - if (NO == self.soundSwitch.on) { - [musicSwitch setOn:NO animated:YES]; - } else { - [self.settingsDictionary setObject:[NSNumber numberWithBool:musicSwitch.on] forKey:@"music"]; - isWriteNeeded = YES; - } -} - --(void) justUpdateDictionary:(id) sender { - UISwitch *theSwitch = (UISwitch *)sender; - [self.settingsDictionary setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; - isWriteNeeded = YES; -} - -/* -#pragma mark - -#pragma mark UIActionSheet Methods --(IBAction) deleteData: (id)sender { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") - delegate:self - cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") - destructiveButtonTitle:NSLocalizedString(@"As sure as I can be!", @"") - otherButtonTitles:nil]; - [actionSheet showInView:self.view]; - [actionSheet release]; -} - --(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if ([actionSheet cancelButtonIndex] != buttonIndex) { - // get the documents dirctory - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - - // get the content of the directory - NSFileManager *fm = [NSFileManager defaultManager]; - NSArray *dirContent = [fm directoryContentsAtPath:documentsDirectory]; - NSError *error; - - // delete data - for (NSString *fileName in dirContent) { - [fm removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:fileName] error:&error]; - } - - // force resetting - UIAlertView *anAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Hit Home Button to Exit", @"") - message:NSLocalizedString(@"\nEverything is gone!\nNow you need to restart the game...", @"") - delegate:self - cancelButtonTitle:nil - otherButtonTitles:nil]; - [anAlert show]; - [anAlert release]; - } -} -*/ - -#pragma mark - -#pragma mark TableView Methods --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 3; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - switch (section) { - case kNetworkFields: - return 2; - break; - case kAudioFields: - return 2; - break; - case kOtherFields: - return 1; - break; - default: - break; - } - return 0; -} - --(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *cellIdentifier = @"systemSettingsCell"; - NSInteger row = [indexPath row]; - NSInteger section = [indexPath section]; - - UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; - if (nil == cell) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; - if (section == kNetworkFields) { - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(-15, 10, 100, 25)]; - label.textAlignment = UITextAlignmentRight; - label.backgroundColor = [UIColor clearColor]; - label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; - if (row == 0) - label.text = NSLocalizedString(@"Nickname","from the settings table"); - else - label.text = NSLocalizedString(@"Password","from the settings table"); - [cell.contentView addSubview:label]; - [label release]; - - UITextField *aTextField = [[UITextField alloc] initWithFrame: - CGRectMake(110, 12, (cell.frame.size.width + cell.frame.size.width/3) - 90, 25)]; - aTextField.clearsOnBeginEditing = NO; - aTextField.returnKeyType = UIReturnKeyDone; - aTextField.adjustsFontSizeToFitWidth = YES; - aTextField.delegate = self; - aTextField.tag = row; - aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; - [cell.contentView addSubview:aTextField]; - [aTextField release]; - } - } - - cell.accessoryType = UITableViewCellAccessoryNone; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.imageView.image = nil; - - UITextField *aTextField; - switch (section) { - case kNetworkFields: - for (UIView *oneView in cell.contentView.subviews) - if ([oneView isMemberOfClass:[UITextField class]]) - aTextField = (UITextField *)oneView; - - switch (row) { - case 0: - aTextField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@""); - aTextField.text = [self.settingsDictionary objectForKey:@"username"]; - break; - case 1: - aTextField.placeholder = NSLocalizedString(@"Insert your password",@""); - aTextField.text = [self.settingsDictionary objectForKey:@"password"]; - aTextField.secureTextEntry = YES; - break; - default: - break; - } - break; - - case kAudioFields: - switch (row) { - case 0: - cell.textLabel.text = NSLocalizedString(@"Sound", @""); - cell.accessoryView = soundSwitch; - break; - case 1: - cell.textLabel.text = NSLocalizedString(@"Music", @""); - cell.accessoryView = musicSwitch; - break; - default: - break; - } - break; - - case kOtherFields: - cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @""); - cell.accessoryView = altDamageSwitch; - break; - default: - break; - } - return cell; -} - --(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - NSString *sectionTitle = nil; - switch (section) { - case kNetworkFields: - sectionTitle = NSLocalizedString(@"Network Configuration", @""); - break; - case kAudioFields: - sectionTitle = NSLocalizedString(@"Audio Preferences", @""); - break; - case kOtherFields: - sectionTitle = NSLocalizedString(@"Other Settings", @""); - break; - default: - NSLog(@"Nope"); - break; - } - return sectionTitle; -} - -/* --(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)] autorelease]; - UILabel *headerLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10, 20, 300, 40)] autorelease]; - headerLabel.textColor = [UIColor lightGrayColor]; - headerLabel.shadowColor = [UIColor blackColor]; - headerLabel.shadowOffset = CGSizeMake(0, 1); - headerLabel.font = [UIFont boldSystemFontOfSize:20]; - headerLabel.backgroundColor = [UIColor clearColor]; - - switch (section) { - case kNetworkFields: - headerLabel.text = NSLocalizedString(@"Network Configuration", @""); - break; - case kAudioFields: - headerLabel.text = NSLocalizedString(@"Audio Preferences", @""); - break; - case kOtherFields: - headerLabel.text = NSLocalizedString(@"Other Settings", @""); - break; - default: - NSLog(@"Warning: unset case value in titleForHeaderInSection!"); - headerLabel.text = @"!"; - break; - } - - [containerView addSubview:headerLabel]; - return containerView; -} - --(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - if (kAudioFields == [indexPath section] && 2 == [indexPath row]) - return volumeCell.frame.size.height; - else - return table.rowHeight; -} - --(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - return 57.0; -} -*/ - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell; - if (kNetworkFields == [indexPath section]) { - cell = [aTableView cellForRowAtIndexPath:indexPath]; - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - textFieldBeingEdited = (UITextField *)oneView; - [textFieldBeingEdited becomeFirstResponder]; - } - } - [aTableView deselectRowAtIndexPath:indexPath animated:NO]; - } -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.settingsDictionary = nil; - self.textFieldBeingEdited = nil; - self.musicSwitch = nil; - self.soundSwitch = nil; - self.altDamageSwitch = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [settingsDictionary release]; - [textFieldBeingEdited release]; - [musicSwitch release]; - [soundSwitch release]; - [altDamageSwitch release]; - [super dealloc]; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GravesViewController.h --- a/cocoaTouch/GravesViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// -// GravesViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface GravesViewController : UITableViewController { - NSMutableDictionary *teamDictionary; - - NSArray *graveArray; - NSIndexPath *lastIndexPath; -} - -@property (nonatomic,retain) NSMutableDictionary *teamDictionary; -@property (nonatomic,retain) NSArray *graveArray; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/GravesViewController.m --- a/cocoaTouch/GravesViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -// -// GravesViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "GravesViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation GravesViewController -@synthesize teamDictionary, graveArray, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - // load all the grave names and store them into graveArray - self.graveArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:GRAVES_DIRECTORY() error:NULL]; -} - --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self.tableView reloadData]; - // this moves the tableview to the top - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.graveArray count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - - NSString *grave = [self.graveArray objectAtIndex:[indexPath row]]; - cell.textLabel.text = [grave stringByDeletingPathExtension]; - - if ([grave isEqualToString:[self.teamDictionary objectForKey:@"grave"]]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - NSString *graveFilePath = [[NSString alloc] initWithFormat:@"%@/%@",GRAVES_DIRECTORY(),grave]; - // because we also have multi frame graves, let's take the first one only - UIImage *graveSprite = [[UIImage alloc] initWithContentsOfFile:graveFilePath andCutAt:CGRectMake(0, 0, 32, 32)]; - [graveFilePath release]; - cell.imageView.image = graveSprite; - [graveSprite release]; - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - [teamDictionary setObject:[[graveArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"grave"]; - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - self.lastIndexPath = indexPath; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; -} - - -#pragma mark - -#pragma mark Memory management -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - -- (void)viewDidUnload { - self.lastIndexPath = nil; - self.teamDictionary = nil; - self.graveArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - -- (void)dealloc { - [graveArray release]; - [teamDictionary release]; - [lastIndexPath release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/HogHatViewController.h --- a/cocoaTouch/HogHatViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// -// HogHatViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface HogHatViewController : UITableViewController { - NSDictionary *teamDictionary; - NSInteger selectedHog; - - NSArray *hatArray; - UIImage *normalHogSprite; - NSIndexPath *lastIndexPath; -} - -@property (nonatomic,retain) NSDictionary *teamDictionary; -@property (nonatomic) NSInteger selectedHog; -@property (nonatomic,retain) NSArray *hatArray; -@property (nonatomic,retain) UIImage *normalHogSprite; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/HogHatViewController.m --- a/cocoaTouch/HogHatViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -// -// HogHatViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "HogHatViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation HogHatViewController -@synthesize teamDictionary, hatArray, normalHogSprite, lastIndexPath, selectedHog; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle -- (void)viewDidLoad { - [super viewDidLoad]; - - // load all the hat file names and store them into hatArray - NSString *hatsDirectory = HATS_DIRECTORY(); - NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:hatsDirectory error:NULL]; - self.hatArray = array; - - // load the base hog image, drawing will occure in cellForRow... - NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; - UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; - [normalHogFile release]; - self.normalHogSprite = hogSprite; - [hogSprite release]; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - self.title = [[[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog] objectForKey:@"hogname"]; - - // this updates the hog name and its hat - [self.tableView reloadData]; - // this moves the tableview to the top - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.hatArray count]; -} - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - - NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog]; - NSString *hat = [hatArray objectAtIndex:[indexPath row]]; - cell.textLabel.text = [hat stringByDeletingPathExtension]; - - NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat]; - UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; - [hatFile release]; - cell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)]; - [hatSprite release]; - - if ([hat isEqualToString:[hog objectForKey:@"hat"]]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate -- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - // if the two selected rows differ update data on the hog dictionary and reload table content - // TODO: maybe this section could be cleaned up - NSDictionary *oldHog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog]; - - NSMutableDictionary *newHog = [[NSMutableDictionary alloc] initWithDictionary: oldHog]; - [newHog setObject:[[hatArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"hat"]; - [[teamDictionary objectForKey:@"hedgehogs"] replaceObjectAtIndex:selectedHog withObject:newHog]; - [newHog release]; - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - self.lastIndexPath = indexPath; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; -} - - -#pragma mark - -#pragma mark Memory management -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - -- (void)viewDidUnload { - self.lastIndexPath = nil; - self.normalHogSprite = nil; - self.teamDictionary = nil; - self.hatArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - -- (void)dealloc { - [hatArray release]; - [teamDictionary release]; - [normalHogSprite release]; - [lastIndexPath release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/LevelViewController.h --- a/cocoaTouch/LevelViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// LevelViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface LevelViewController : UITableViewController { - NSDictionary *teamDictionary; - - NSArray *levelArray; - NSArray *levelSprites; - NSIndexPath *lastIndexPath; -} - -@property (nonatomic,retain) NSDictionary *teamDictionary; -@property (nonatomic,retain) NSArray *levelArray; -@property (nonatomic,retain) NSArray *levelSprites; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/LevelViewController.m --- a/cocoaTouch/LevelViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -// -// LevelViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "LevelViewController.h" -#import "CommodityFunctions.h" - - -@implementation LevelViewController -@synthesize teamDictionary, levelArray, levelSprites, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle -- (void)viewDidLoad { - [super viewDidLoad]; - - NSArray *array = [[NSArray alloc] initWithObjects: - NSLocalizedString(@"Human",@""), - NSLocalizedString(@"Brutal",@""), - NSLocalizedString(@"Aggressive",@""), - NSLocalizedString(@"Bully",@""), - NSLocalizedString(@"Average",@""), - NSLocalizedString(@"Weaky",@""), - nil]; - self.levelArray = array; - [array release]; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self.tableView reloadData]; - // this moves the tableview to the top - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.levelArray count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - NSInteger row = [indexPath row]; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - cell.textLabel.text = [levelArray objectAtIndex:row]; - NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0]; - if ([[hog objectForKey:@"level"] intValue] == row) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - NSString *botlevelPath = [[NSString alloc] initWithFormat:@"%@/%d.png",BOTLEVELS_DIRECTORY(),row]; - UIImage *levelImage = [[UIImage alloc] initWithContentsOfFile:botlevelPath]; - [botlevelPath release]; - cell.imageView.image = levelImage; - [levelImage release]; - - return cell; -} - - -/* -// Override to support conditional editing of the table view. -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the specified item to be editable. - return YES; -} -*/ - - -/* -// Override to support editing the table view. -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; - } - else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } -} -*/ - - -/* -// Override to support rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { -} -*/ - - -/* -// Override to support conditional rearranging of the table view. -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the item to be re-orderable. - return YES; -} -*/ - - -#pragma mark - -#pragma mark Table view delegate -- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - NSMutableArray *hogs = [teamDictionary objectForKey:@"hedgehogs"]; - - for (NSMutableDictionary *hog in hogs) { - [hog setObject:[NSNumber numberWithInt:newRow] forKey:@"level"]; - } - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - [self.tableView reloadData]; - - self.lastIndexPath = indexPath; - [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - [self.navigationController popViewControllerAnimated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.lastIndexPath = nil; - self.teamDictionary = nil; - self.levelArray = nil; - self.levelSprites = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [levelArray release]; - [levelSprites release]; - [teamDictionary release]; - [lastIndexPath release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MainMenuViewController.h --- a/cocoaTouch/MainMenuViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// -// MainMenuViewController.h -// hwengine -// -// Created by Vittorio on 08/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class SplitViewRootController; -@class GameConfigViewController; - -@interface MainMenuViewController : UIViewController { - UILabel *versionLabel; - SplitViewRootController *settingsViewController; - GameConfigViewController *gameConfigViewController; -} - -@property (nonatomic,retain) IBOutlet UILabel *versionLabel; - --(IBAction) switchViews:(id)sender; -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MainMenuViewController.m --- a/cocoaTouch/MainMenuViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -// -// MainMenuViewController.m -// hwengine -// -// Created by Vittorio on 08/01/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "MainMenuViewController.h" -#import "SDL_uikitappdelegate.h" -#import "PascalImports.h" -#import "GameConfigViewController.h" -#import "SplitViewRootController.h" -#import "CommodityFunctions.h" - -@implementation MainMenuViewController -@synthesize versionLabel; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - if (settingsViewController.view.superview == nil) - settingsViewController = nil; - if (gameConfigViewController.view.superview == nil) - gameConfigViewController = nil; - MSG_MEMCLEAN(); -} - --(void) viewDidLoad { - char *ver; - HW_versionInfo(NULL, &ver); - NSString *versionNumber = [[NSString alloc] initWithCString:ver]; - self.versionLabel.text = versionNumber; - [versionNumber release]; - - // listen to request to remove the modalviewcontroller - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(dismissModalViewController) - name: @"dismissModalView" - object:nil]; - - // initialize some files the first time we load the game - if (!([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()])) - [NSThread detachNewThreadSelector:@selector(checkFirstRun) toTarget:self withObject:nil]; - - [super viewDidLoad]; -} - -// this is called to verify whether it's the first time the app is launched -// if it is it blocks user interaction with an alertView until files are created --(void) checkFirstRun { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSLog(@"First time run, creating settings files at %@", SETTINGS_FILE()); - - // show a popup with an indicator to make the user wait - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Please wait",@"") - message:nil - delegate:nil - cancelButtonTitle:nil - otherButtonTitles:nil]; - [alert show]; - - UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] - initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50); - [indicator startAnimating]; - [alert addSubview:indicator]; - [indicator release]; - - // create a team - createTeamNamed(@"Pirates"); - createTeamNamed(@"Ninjas"); - - createSchemeNamed(@"Default"); - - // create settings.plist - NSMutableDictionary *saveDict = [[NSMutableDictionary alloc] init]; - - [saveDict setObject:@"" forKey:@"username"]; - [saveDict setObject:@"" forKey:@"password"]; - [saveDict setObject:[NSNumber numberWithBool:YES] forKey:@"music"]; - [saveDict setObject:[NSNumber numberWithBool:YES] forKey:@"sound"]; - [saveDict setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"]; - - [saveDict writeToFile:SETTINGS_FILE() atomically:YES]; - [saveDict release]; - - // ok let the user take control - [alert dismissWithClickedButtonIndex:0 animated:YES]; - [alert release]; - - [pool release]; - [NSThread exit]; -} - -#pragma mark - --(IBAction) switchViews:(id) sender { - UIButton *button = (UIButton *)sender; - UIAlertView *alert; - NSString *debugStr, *configNibName; - - switch (button.tag) { - case 0: - // bug in UIModalTransitionStylePartialCurl, displays the controller awkwardly if it is not allocated every time - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - configNibName = @"GameConfigViewController-iPad"; - else - configNibName = @"GameConfigViewController-iPhone"; - - gameConfigViewController = [[GameConfigViewController alloc] initWithNibName:configNibName bundle:nil]; -#ifdef __IPHONE_3_2 - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - gameConfigViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl; -#endif - [self presentModalViewController:gameConfigViewController animated:YES]; - break; - case 2: - if (nil == settingsViewController) { - settingsViewController = [[SplitViewRootController alloc] initWithNibName:nil bundle:nil]; - settingsViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; - } - - [self presentModalViewController:settingsViewController animated:YES]; - break; - case 3: - debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()]; - UITextView *scroll = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)]; - scroll.text = debugStr; - [debugStr release]; - scroll.editable = NO; - - UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; - [btn addTarget:scroll action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside]; - btn.backgroundColor = [UIColor blackColor]; - btn.frame = CGRectMake(self.view.frame.size.height-70, 0, 70, 70); - [scroll addSubview:btn]; - [self.view addSubview:scroll]; - [scroll release]; - break; - default: - alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented" - message:@"Sorry, this feature is not yet implemented" - delegate:nil - cancelButtonTitle:@"Well, don't worry" - otherButtonTitles:nil]; - [alert show]; - [alert release]; - break; - } -} - -// allows child controllers to return to the main controller --(void) dismissModalViewController { - [self dismissModalViewControllerAnimated:YES]; -} - - --(void) viewDidUnload { - self.versionLabel = nil; - gameConfigViewController = nil; - settingsViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [versionLabel release]; - [settingsViewController release]; - [gameConfigViewController release]; - [super dealloc]; -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MapConfigViewController.h --- a/cocoaTouch/MapConfigViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -// -// MapConfigViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 22/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import -#import "SDL_net.h" - -@interface MapConfigViewController : UIViewController { - TCPsocket sd, csd; - NSInteger oldValue; //slider - NSInteger oldPage; //segmented control - BOOL busy; - - // objects read (mostly) by parent view - NSInteger maxHogs; - NSString *seedCommand; - NSString *templateFilterCommand; - NSString *mapGenCommand; - NSString *mazeSizeCommand; - NSString *themeCommand; - - // various widgets in the view - UIButton *previewButton; - UITableView *tableView; - UILabel *maxLabel; - UILabel *sizeLabel; - UISegmentedControl *segmentedControl; - UISlider *slider; - - // internal objects - NSIndexPath *lastIndexPath; - NSArray *themeArray; - NSArray *mapArray; -} - -@property (nonatomic) NSInteger maxHogs; -@property (nonatomic) BOOL busy; -@property (nonatomic,retain) NSString *seedCommand; -@property (nonatomic,retain) NSString *templateFilterCommand; -@property (nonatomic,retain) NSString *mapGenCommand; -@property (nonatomic,retain) NSString *mazeSizeCommand; -@property (nonatomic,retain) NSString *themeCommand; - -@property (nonatomic,retain) IBOutlet UIButton *previewButton; -@property (nonatomic,retain) IBOutlet UITableView *tableView; -@property (nonatomic,retain) IBOutlet UILabel *maxLabel; -@property (nonatomic,retain) IBOutlet UILabel *sizeLabel; -@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl; -@property (nonatomic,retain) IBOutlet UISlider *slider; - -@property (nonatomic,retain) NSIndexPath *lastIndexPath; -@property (nonatomic,retain) NSArray *themeArray; -@property (nonatomic,retain) NSArray *mapArray; - --(IBAction) updatePreview; --(IBAction) sliderChanged:(id) sender; --(IBAction) sliderEndedChanging:(id) sender; --(IBAction) segmentedControlChanged:(id) sender; --(void) turnOnWidgets; --(void) turnOffWidgets; --(void) setLabelText:(NSString *)str; --(void) setButtonImage:(UIImage *)img; - --(const uint8_t *)engineProtocol:(NSInteger) port; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MapConfigViewController.m --- a/cocoaTouch/MapConfigViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,565 +0,0 @@ -// -// MapConfigViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 22/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "MapConfigViewController.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "SDL_net.h" -#import - -#define INDICATOR_TAG 7654 - -@implementation MapConfigViewController -@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, - tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, themeArray, mapArray, busy; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -#pragma mark - -#pragma mark Preview Handling --(int) sendToEngine: (NSString *)string { - unsigned char length = [string length]; - - SDLNet_TCP_Send(csd, &length , 1); - return SDLNet_TCP_Send(csd, [string UTF8String], length); -} - --(const uint8_t *)engineProtocol:(NSInteger) port { - IPaddress ip; - BOOL serverQuit = NO; - static uint8_t map[128*32]; - - if (SDLNet_Init() < 0) { - NSLog(@"SDLNet_Init: %s", SDLNet_GetError()); - serverQuit = YES; - } - - // Resolving the host using NULL make network interface to listen - if (SDLNet_ResolveHost(&ip, NULL, port) < 0) { - NSLog(@"SDLNet_ResolveHost: %s\n", SDLNet_GetError()); - serverQuit = YES; - } - - // Open a connection with the IP provided (listen on the host's port) - if (!(sd = SDLNet_TCP_Open(&ip))) { - NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), port); - serverQuit = YES; - } - - // launch the preview here so that we're sure the tcp channel is open - pthread_t thread_id; - pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port); - pthread_detach(thread_id); - - DLog(@"Waiting for a client on port %d", port); - while (!serverQuit) { - /* This check the sd if there is a pending connection. - * If there is one, accept that, and open a new socket for communicating */ - csd = SDLNet_TCP_Accept(sd); - if (NULL != csd) { - DLog(@"Client found"); - - [self sendToEngine:self.seedCommand]; - [self sendToEngine:self.templateFilterCommand]; - [self sendToEngine:self.mapGenCommand]; - [self sendToEngine:self.mazeSizeCommand]; - [self sendToEngine:@"!"]; - - memset(map, 0, 128*32); - SDLNet_TCP_Recv(csd, map, 128*32); - SDLNet_TCP_Recv(csd, &maxHogs, sizeof(uint8_t)); - - SDLNet_TCP_Close(csd); - serverQuit = YES; - } - } - - SDLNet_TCP_Close(sd); - SDLNet_Quit(); - return map; -} - --(void) drawingThread { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // select the port for IPC and launch the preview generation through engineProtocol: - int port = randomPort(); - const uint8_t *map = [self engineProtocol:port]; - uint8_t mapExp[128*32*8]; - - // draw the buffer (1 pixel per component, 0= transparent 1= color) - int k = 0; - for (int i = 0; i < 32*128; i++) { - unsigned char byte = map[i]; - for (int j = 0; j < 8; j++) { - // select the color based on the leftmost bit - if ((byte & 0x80) != 0) - mapExp[k] = 100; - else - mapExp[k] = 255; - // shift to next bit - byte <<= 1; - k++; - } - } - CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); - CGContextRef bitmapImage = CGBitmapContextCreate(mapExp, 256, 128, 8, 256, colorspace, kCGImageAlphaNone); - CGColorSpaceRelease(colorspace); - - CGImageRef previewCGImage = CGBitmapContextCreateImage(bitmapImage); - UIImage *previewImage = [[UIImage alloc] initWithCGImage:previewCGImage]; - CGImageRelease(previewCGImage); - - // set the preview image (autoreleased) in the button and the maxhog label on the main thread to prevent a leak - [self performSelectorOnMainThread:@selector(setButtonImage:) withObject:[[previewImage retain] makeRoundCornersOfSize:CGSizeMake(12, 12)] waitUntilDone:NO]; - [self performSelectorOnMainThread:@selector(setLabelText:) withObject:[NSString stringWithFormat:@"%d", maxHogs] waitUntilDone:NO]; - - // restore functionality of button and remove the spinning wheel on the main thread to prevent a leak - [self performSelectorOnMainThread:@selector(turnOnWidgets) withObject:nil waitUntilDone:NO]; - - [pool release]; - //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution. - //[NSThread exit]; - - /* - // http://developer.apple.com/mac/library/qa/qa2001/qa1037.html - UIGraphicsBeginImageContext(CGSizeMake(256,128)); - CGContextRef context = UIGraphicsGetCurrentContext(); - UIGraphicsPushContext(context); - - CGContextSetRGBFillColor(context, 0.5, 0.5, 0.7, 1.0); - CGContextFillRect(context,CGRectMake(xc,yc,1,1)); - - UIGraphicsPopContext(); - UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - */ -} - --(IBAction) updatePreview { - // don't generate a new preview while it's already generating one - if (busy) - return; - - // generate a seed - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); - CFRelease(uuid); - NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; - [seed release]; - self.seedCommand = seedCmd; - [seedCmd release]; - - NSIndexPath *theIndex; - if (segmentedControl.selectedSegmentIndex != 1) { - // prevent other events and add an activity while the preview is beign generated - [self turnOffWidgets]; - - // remove the current preview - [self.previewButton setImage:nil forState:UIControlStateNormal]; - - // add a very nice spinning wheel - UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] - initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - indicator.center = CGPointMake(previewButton.bounds.size.width / 2, previewButton.bounds.size.height / 2); - indicator.tag = INDICATOR_TAG; - [indicator startAnimating]; - [self.previewButton addSubview:indicator]; - [indicator release]; - - // let's draw in a separate thread so the gui can work; at the end it restore other widgets - [NSThread detachNewThreadSelector:@selector(drawingThread) toTarget:self withObject:nil]; - - theIndex = [NSIndexPath indexPathForRow:(random()%[self.themeArray count]) inSection:0]; - } else { - theIndex = [NSIndexPath indexPathForRow:(random()%[self.mapArray count]) inSection:0]; - } - [self.tableView reloadData]; - [self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; - [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES]; -} - --(void) updatePreviewWithMap:(NSInteger) index { - // change the preview button - NSString *fileImage = [[NSString alloc] initWithFormat:@"%@/%@/preview.png", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]]; - UIImage *image = [[UIImage alloc] initWithContentsOfFile:fileImage]; - [fileImage release]; - [self.previewButton setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:UIControlStateNormal]; - - // update label - maxHogs = 18; - NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]]; - NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL]; - [fileCfg release]; - NSArray *split = [contents componentsSeparatedByString:@"\n"]; - - // if the number is not set we keep 18 standard; - // sometimes it's not set but there are trailing characters, we get around them with the second equation - if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0) - maxHogs = [[split objectAtIndex:1] intValue]; - [contents release]; - NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs]; - self.maxLabel.text = max; - [max release]; -} - --(void) turnOffWidgets { - busy = YES; - self.previewButton.alpha = 0.5f; - self.previewButton.enabled = NO; - self.maxLabel.text = @"..."; - self.segmentedControl.enabled = NO; - self.slider.enabled = NO; -} - --(void) turnOnWidgets { - self.previewButton.alpha = 1.0f; - self.previewButton.enabled = YES; - self.segmentedControl.enabled = YES; - self.slider.enabled = YES; - busy = NO; - - UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.previewButton viewWithTag:INDICATOR_TAG]; - if (indicator) { - [indicator stopAnimating]; - [indicator removeFromSuperview]; - } -} - --(void) setLabelText:(NSString *)str { - self.maxLabel.text = str; -} - --(void) setButtonImage:(UIImage *)img { - [self.previewButton setBackgroundImage:img forState:UIControlStateNormal]; -} - --(void) restoreBackgroundImage { - // white rounded rectangle as background image for previewButton - UIGraphicsBeginImageContext(CGSizeMake(256,128)); - CGContextRef context = UIGraphicsGetCurrentContext(); - UIGraphicsPushContext(context); - - CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); - CGContextFillRect(context,CGRectMake(0,0,256,128)); - - UIGraphicsPopContext(); - UIImage *bkgImg = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - [self.previewButton setBackgroundImage:[[bkgImg retain] makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:UIControlStateNormal]; -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { - if (self.segmentedControl.selectedSegmentIndex != 1) - return [themeArray count]; - else - return [mapArray count]; -} - --(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - NSInteger row = [indexPath row]; - - UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - - if (self.segmentedControl.selectedSegmentIndex != 1) { - // the % prevents a strange bug that occurs sporadically - NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]]; - cell.textLabel.text = themeName; - UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]]; - cell.imageView.image = image; - [image release]; - } else { - cell.textLabel.text = [self.mapArray objectAtIndex:row]; - cell.imageView.image = nil; - } - - if (row == [self.lastIndexPath row]) - cell.accessoryType = UITableViewCellAccessoryCheckmark; - else - cell.accessoryType = UITableViewCellAccessoryNone; - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - if (self.segmentedControl.selectedSegmentIndex != 1) { - NSString *theme = [self.themeArray objectAtIndex:newRow]; - self.themeCommand = [NSString stringWithFormat:@"etheme %@", theme]; - } else - [self updatePreviewWithMap:newRow]; - - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - - self.lastIndexPath = indexPath; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark - -#pragma mark slider & segmentedControl -// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl -// no methods are called by this routine and you can pass nil to it --(IBAction) sliderChanged:(id) sender { - NSString *labelText; - NSString *templateCommand; - NSString *mazeCommand; - - switch ((int)(self.slider.value*100)) { - case 0: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"Wacky",@""); - } else { - labelText = NSLocalizedString(@"Large Floating Islands",@""); - } - templateCommand = @"e$template_filter 5"; - mazeCommand = @"e$maze_size 5"; - break; - case 1: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"Cavern",@""); - } else { - labelText = NSLocalizedString(@"Medium Floating Islands",@""); - } - templateCommand = @"e$template_filter 4"; - mazeCommand = @"e$maze_size 4"; - break; - case 2: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"Small",@""); - } else { - labelText = NSLocalizedString(@"Small Floating Islands",@""); - } - templateCommand = @"e$template_filter 1"; - mazeCommand = @"e$maze_size 3"; - break; - case 3: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"Medium",@""); - } else { - labelText = NSLocalizedString(@"Large Tunnels",@""); - } - templateCommand = @"e$template_filter 2"; - mazeCommand = @"e$maze_size 2"; - break; - case 4: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"Large",@""); - } else { - labelText = NSLocalizedString(@"Medium Tunnels",@""); - } - templateCommand = @"e$template_filter 3"; - mazeCommand = @"e$maze_size 1"; - break; - case 5: - if (self.segmentedControl.selectedSegmentIndex == 0) { - labelText = NSLocalizedString(@"All",@""); - } else { - labelText = NSLocalizedString(@"Small Tunnels",@""); - } - templateCommand = @"e$template_filter 0"; - mazeCommand = @"e$maze_size 0"; - break; - default: - labelText = nil; - templateCommand = nil; - mazeCommand = nil; - break; - } - - self.sizeLabel.text = labelText; - self.templateFilterCommand = templateCommand; - self.mazeSizeCommand = mazeCommand; -} - -// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up --(IBAction) sliderEndedChanging:(id) sender { - int num = (int) (self.slider.value * 100); - if (oldValue != num) { - [self updatePreview]; - oldValue = num; - } -} - -// perform actions based on the activated section, then call updatePreview to visually update the selection -// updatePreview will call didSelectRowAtIndexPath which will call the right update routine) -// and if necessary update the table with a slide animation --(IBAction) segmentedControlChanged:(id) sender { - NSString *mapgen; - NSInteger newPage = self.segmentedControl.selectedSegmentIndex; - - switch (newPage) { - case 0: // Random - mapgen = @"e$mapgen 0"; - [self sliderChanged:nil]; - self.slider.enabled = YES; - break; - - case 1: // Map - mapgen = @"e$mapgen 0"; - self.slider.enabled = NO; - self.sizeLabel.text = @"."; - [self restoreBackgroundImage]; - break; - - case 2: // Maze - mapgen = @"e$mapgen 1"; - [self sliderChanged:nil]; - self.slider.enabled = YES; - break; - - default: - mapgen = nil; - break; - } - self.mapGenCommand = mapgen; - [self updatePreview]; - - // nice animation for updating the table when appropriate (on iphone) - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) - if (((oldPage == 0 || oldPage == 2) && newPage == 1) || - (oldPage == 1 && (newPage == 0 || newPage == 2))) { - [UIView beginAnimations:@"moving out table" context:NULL]; - self.tableView.frame = CGRectMake(480, 0, 185, 276); - [UIView commitAnimations]; - [self performSelector:@selector(moveTable) withObject:nil afterDelay:0.2]; - } - oldPage = newPage; -} - -// update data when table is not visible and then show it --(void) moveTable { - [self.tableView reloadData]; - - [UIView beginAnimations:@"moving in table" context:NULL]; - self.tableView.frame = CGRectMake(295, 0, 185, 276); - [UIView commitAnimations]; -} - -#pragma mark - -#pragma mark view management --(void) viewDidLoad { - [super viewDidLoad]; - - srandom(time(NULL)); - - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); - - // themes.cfg contains all the user-selectable themes - NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] - encoding:NSUTF8StringEncoding - error:NULL]; - NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; - [string release]; - // remove a trailing "" element - [array removeLastObject]; - self.themeArray = array; - [array release]; - self.mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; - - self.tableView.rowHeight = 42; - busy = NO; - - // draw a white background - [self restoreBackgroundImage]; - - // initialize some "default" values - self.sizeLabel.text = NSLocalizedString(@"All",@""); - self.slider.value = 0.05f; - self.segmentedControl.selectedSegmentIndex = 0; - - self.templateFilterCommand = @"e$template_filter 0"; - self.mazeSizeCommand = @"e$maze_size 0"; - self.mapGenCommand = @"e$mapgen 0"; - self.lastIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; - - oldValue = 5; - oldPage = 0; -} - --(void) viewDidAppear:(BOOL) animated { - [super viewDidAppear:animated]; - [self updatePreview]; -} - -#pragma mark - -#pragma mark memory --(void) didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - --(void) viewDidUnload { - self.previewButton = nil; - self.seedCommand = nil; - self.templateFilterCommand = nil; - self.mapGenCommand = nil; - self.mazeSizeCommand = nil; - self.themeCommand = nil; - - self.previewButton = nil; - self.tableView = nil; - self.maxLabel = nil; - self.sizeLabel = nil; - self.segmentedControl = nil; - self.slider = nil; - - self.lastIndexPath = nil; - self.themeArray = nil; - self.mapArray = nil; - - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [seedCommand release]; - [templateFilterCommand release]; - [mapGenCommand release]; - [mazeSizeCommand release]; - [themeCommand release]; - - [previewButton release]; - [tableView release]; - [maxLabel release]; - [sizeLabel release]; - [segmentedControl release]; - [slider release]; - - [lastIndexPath release]; - [themeArray release]; - [mapArray release]; - - [super dealloc]; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MasterViewController.h --- a/cocoaTouch/MasterViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -// -// MasterViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@class DetailViewController; -@class GeneralSettingsViewController; -@class TeamSettingsViewController; -@class WeaponSettingsViewController; -@class SchemeSettingsViewController; - -@interface MasterViewController : UITableViewController { - DetailViewController *detailViewController; - NSArray *controllerNames; - NSIndexPath *lastIndexPath; - GeneralSettingsViewController *generalSettingsViewController; - TeamSettingsViewController *teamSettingsViewController; - WeaponSettingsViewController *weaponSettingsViewController; - SchemeSettingsViewController *schemeSettingsViewController; -} - -@property (nonatomic, retain) DetailViewController *detailViewController; -@property (nonatomic, retain) NSArray *controllerNames; -@property (nonatomic, retain) NSIndexPath *lastIndexPath; - --(IBAction) dismissSplitView; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/MasterViewController.m --- a/cocoaTouch/MasterViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -// -// MasterViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "MasterViewController.h" -#import "DetailViewController.h" -#import "GeneralSettingsViewController.h" -#import "TeamSettingsViewController.h" -#import "WeaponSettingsViewController.h" -#import "SchemeSettingsViewController.h" -#import "CommodityFunctions.h" - -@implementation MasterViewController -@synthesize detailViewController, controllerNames, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - // the list of selectable controllers - controllerNames = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), - NSLocalizedString(@"Teams",@""), - NSLocalizedString(@"Weapons",@""), - NSLocalizedString(@"Schemes",@""), - nil]; - // the "Done" button on top left - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(dismissSplitView)]; -} - -#pragma mark - -#pragma mark Table view data source - --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [controllerNames count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]]; - } - - return cell; -} - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - UIViewController *nextController = nil; - - if (newRow != oldRow) { - [self.tableView deselectRowAtIndexPath:lastIndexPath animated:YES]; - [detailViewController.navigationController popToRootViewControllerAnimated:NO]; - - switch (newRow) { - case 0: - if (nil == generalSettingsViewController) - generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = generalSettingsViewController; - break; - case 1: - if (nil == teamSettingsViewController) - teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = teamSettingsViewController; - break; - case 2: - if (nil == weaponSettingsViewController) - weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = weaponSettingsViewController; - break; - case 3: - if (nil == schemeSettingsViewController) - schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = schemeSettingsViewController; - break; - } - - nextController.navigationItem.hidesBackButton = YES; - nextController.title = [controllerNames objectAtIndex:newRow]; - [detailViewController.navigationController pushViewController:nextController animated:NO]; - self.lastIndexPath = indexPath; - [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. - if (generalSettingsViewController.view.superview == nil) - generalSettingsViewController = nil; - if (teamSettingsViewController.view.superview == nil) - teamSettingsViewController = nil; - if (weaponSettingsViewController.view.superview == nil) - weaponSettingsViewController = nil; - if (schemeSettingsViewController.view.superview == nil) - schemeSettingsViewController = nil; - MSG_MEMCLEAN(); -} - --(void) viewDidUnload { - self.detailViewController = nil; - self.controllerNames = nil; - self.lastIndexPath = nil; - generalSettingsViewController = nil; - teamSettingsViewController = nil; - weaponSettingsViewController = nil; - schemeSettingsViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [controllerNames release]; - [detailViewController release]; - [lastIndexPath release]; - [generalSettingsViewController release]; - [teamSettingsViewController release]; - [weaponSettingsViewController release]; - [schemeSettingsViewController release]; - [super dealloc]; -} - --(IBAction) dismissSplitView { - [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; -} - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/OverlayViewController.h --- a/cocoaTouch/OverlayViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -// -// overlayViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 16/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class PopoverMenuViewController; - -@interface OverlayViewController : UIViewController { - NSTimer *dimTimer; -#if __IPHONE_3_2 - UIPopoverController *popoverController; -#else - id popoverController; -#endif - PopoverMenuViewController *popupMenu; - BOOL isPopoverVisible; - - UITextField *writeChatTextField; - - CGFloat initialDistanceForPinching; - CGPoint gestureStartPoint; -} - -@property (nonatomic,retain) id popoverController; -@property (nonatomic,retain) PopoverMenuViewController *popupMenu; -@property (nonatomic,retain) UITextField *writeChatTextField; - --(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; - --(IBAction) buttonReleased:(id) sender; --(IBAction) buttonPressed:(id) sender; - --(void) showPopover; --(void) dismissPopover; --(void) dimOverlay; --(void) activateOverlay; --(void) chatAppear; --(void) chatDisappear; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/OverlayViewController.m --- a/cocoaTouch/OverlayViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,428 +0,0 @@ -// -// overlayViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 16/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "OverlayViewController.h" -#import "SDL_uikitappdelegate.h" -#import "PascalImports.h" -#import "CGPointUtils.h" -#import "SDL_mouse.h" -#import "SDL_config_iphoneos.h" -#import "PopoverMenuViewController.h" -#import "CommodityFunctions.h" - -#define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] -#define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] - - -@implementation OverlayViewController -@synthesize popoverController, popupMenu, writeChatTextField; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Release any cached data, images, etc that aren't in use. - if (popupMenu.view.superview == nil) - popupMenu = nil; -} - --(void) didRotate:(NSNotification *)notification { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; - CGRect rect = [[UIScreen mainScreen] bounds]; - CGRect usefulRect = CGRectMake(0, 0, rect.size.width, rect.size.height); - UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:12345]; - - [UIView beginAnimations:@"rotation" context:NULL]; - [UIView setAnimationDuration:0.8f]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; - switch (orientation) { - case UIDeviceOrientationLandscapeLeft: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(0)); - self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); - [self chatDisappear]; - HW_setLandscape(YES); - break; - case UIDeviceOrientationLandscapeRight: - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(180)); - self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90)); - [self chatDisappear]; - HW_setLandscape(YES); - break; - case UIDeviceOrientationPortrait: - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(270)); - self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(0)); - [self chatAppear]; - HW_setLandscape(NO); - } - break; - case UIDeviceOrientationPortraitUpsideDown: - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); - self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(180)); - [self chatAppear]; - HW_setLandscape(NO); - } - break; - default: - DLog(@"Unknown rotation status"); - break; - } - self.view.frame = usefulRect; - //sdlView.frame = usefulRect; - [UIView commitAnimations]; -} - --(void) chatAppear { - if (writeChatTextField == nil) { - writeChatTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 100, 768, [UIFont systemFontSize]+8)]; - writeChatTextField.textColor = [UIColor whiteColor]; - writeChatTextField.backgroundColor = [UIColor blueColor]; - writeChatTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; - writeChatTextField.autocorrectionType = UITextAutocorrectionTypeNo; - writeChatTextField.enablesReturnKeyAutomatically = NO; - writeChatTextField.keyboardAppearance = UIKeyboardAppearanceDefault; - writeChatTextField.keyboardType = UIKeyboardTypeDefault; - writeChatTextField.returnKeyType = UIReturnKeyDefault; - writeChatTextField.secureTextEntry = NO; - [self.view addSubview:writeChatTextField]; - } - writeChatTextField.alpha = 1; - [self activateOverlay]; - [dimTimer setFireDate:HIDING_TIME_NEVER]; -} - --(void) chatDisappear { - writeChatTextField.alpha = 0; - [writeChatTextField resignFirstResponder]; - [dimTimer setFireDate:HIDING_TIME_DEFAULT]; -} - --(void) viewDidLoad { - isPopoverVisible = NO; - self.view.alpha = 0; - self.view.center = CGPointMake(self.view.frame.size.height/2.0, self.view.frame.size.width/2.0); - - - dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] - interval:1000 - target:self - selector:@selector(dimOverlay) - userInfo:nil - repeats:YES]; - - // add timer too runloop, otherwise it doesn't work - [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode]; - - // listen for dismissal of the popover (see below) - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(dismissPopover) - name:@"dismissPopover" - object:nil]; - - [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didRotate:) - name:@"UIDeviceOrientationDidChangeNotification" - object:nil]; - - //self.view.transform = CGAffineTransformRotate(self.view.transform, (M_PI/2.0)); - [UIView beginAnimations:@"showing overlay" context:NULL]; - [UIView setAnimationDuration:1]; - self.view.alpha = 1; - [UIView commitAnimations]; -} - --(void) viewDidUnload { - self.writeChatTextField = nil; - self.popoverController = nil; - self.popupMenu = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [dimTimer invalidate]; - [writeChatTextField release]; - [popupMenu release]; - [popoverController release]; - // dimTimer is autoreleased - [super dealloc]; -} - -// dim the overlay when there's no more input for a certain amount of time --(IBAction) buttonReleased:(id) sender { - HW_allKeysUp(); - [dimTimer setFireDate:HIDING_TIME_DEFAULT]; -} - -// nice transition for dimming, should be called only by the timer himself --(void) dimOverlay { - [UIView beginAnimations:@"overlay dim" context:NULL]; - [UIView setAnimationDuration:0.6]; - self.view.alpha = 0.2; - [UIView commitAnimations]; -} - -// set the overlay visible and put off the timer for enough time --(void) activateOverlay { - self.view.alpha = 1; - [dimTimer setFireDate:HIDING_TIME_NEVER]; -} - -// issue certain action based on the tag of the button --(IBAction) buttonPressed:(id) sender { - [self activateOverlay]; - if (isPopoverVisible) { - [self dismissPopover]; - } - UIButton *theButton = (UIButton *)sender; - - switch (theButton.tag) { - case 0: - HW_walkLeft(); - break; - case 1: - HW_walkRight(); - break; - case 2: - HW_aimUp(); - break; - case 3: - HW_aimDown(); - break; - case 4: - HW_shoot(); - break; - case 5: - HW_jump(); - break; - case 6: - HW_backjump(); - break; - case 7: - HW_tab(); - break; - case 10: - [self showPopover]; - break; - default: - NSLog(@"Nope"); - break; - } -} - -// present a further check before closing game --(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if ([actionSheet cancelButtonIndex] != buttonIndex) - HW_terminate(NO); - else - HW_pause(); -} - -// show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize -// on iphone instead just use the tableViewController directly (and implement manually all animations) --(IBAction) showPopover{ - isPopoverVisible = YES; - CGRect anchorForPopover; - Class popoverControllerClass = NSClassFromString(@"UIPopoverController"); - if (popoverControllerClass) { -#if __IPHONE_3_2 - if (popupMenu == nil) - popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStylePlain]; - popoverController = [[popoverControllerClass alloc] initWithContentViewController:popupMenu]; - [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES]; - [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]]; - - if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) - anchorForPopover = CGRectMake(960, 0, 220, 32); - else - anchorForPopover = CGRectMake(736, 0, 220, 32); - - [popoverController presentPopoverFromRect:anchorForPopover - inView:self.view - permittedArrowDirections:UIPopoverArrowDirectionUp - animated:YES]; -#endif - } else { - if (popupMenu == nil) - popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; - popupMenu.view.backgroundColor = [UIColor clearColor]; - popupMenu.view.frame = CGRectMake(480, 0, 200, 170); - [self.view addSubview:popupMenu.view]; - - [UIView beginAnimations:@"showing popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - popupMenu.view.frame = CGRectMake(280, 0, 200, 170); - [UIView commitAnimations]; - } - popupMenu.tableView.scrollEnabled = NO; -} - -// on ipad just dismiss it, on iphone transtion to the right --(void) dismissPopover { - if (YES == isPopoverVisible) { - isPopoverVisible = NO; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 - [popoverController dismissPopoverAnimated:YES]; -#endif - } else { - [UIView beginAnimations:@"hiding popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - popupMenu.view.frame = CGRectMake(480, 0, 200, 170); - [UIView commitAnimations]; - - [popupMenu.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35]; - [popupMenu performSelector:@selector(release) withObject:nil afterDelay:0.35]; - } - [self buttonReleased:nil]; - } -} - --(void) textFieldDoneEditing:(id) sender{ - [sender resignFirstResponder]; -} - -#pragma mark - -#pragma mark Custom touch event handling - -#define kMinimumPinchDelta 50 - - --(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - NSArray *twoTouches; - UITouch *touch = [touches anyObject]; - - if (isPopoverVisible) { - [self dismissPopover]; - } - if (writeChatTextField) { - [self.writeChatTextField resignFirstResponder]; - [dimTimer setFireDate:HIDING_TIME_DEFAULT]; - } - - gestureStartPoint = [touch locationInView:self.view]; - - switch ([touches count]) { - case 1: - initialDistanceForPinching = 0; - switch ([touch tapCount]) { - case 1: - NSLog(@"X:%d Y:%d", (int)gestureStartPoint.x, (int)gestureStartPoint.y ); - //SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, - // (int)gestureStartPoint.y, width - (int)gestureStartPoint.x); - //HW_click(); - break; - case 2: - HW_ammoMenu(); - break; - default: - break; - } - break; - case 2: - if (2 == [touch tapCount]) { - HW_zoomReset(); - } - - // pinching - gestureStartPoint.x = 0; - gestureStartPoint.y = 0; - twoTouches = [touches allObjects]; - UITouch *first = [twoTouches objectAtIndex:0]; - UITouch *second = [twoTouches objectAtIndex:1]; - initialDistanceForPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); - break; - default: - break; - } - -} - --(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - initialDistanceForPinching = 0; - HW_allKeysUp(); -} - --(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - // this can happen if the user puts more than 5 touches on the screen at once, or perhaps in other circumstances - [self touchesEnded:touches withEvent:event]; -} - --(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - CGFloat minimumGestureLength; - int logCoeff; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - minimumGestureLength = 5.0f; - logCoeff = 19; - } else { - minimumGestureLength = 3.0f; - logCoeff = 3; - } - - NSArray *twoTouches; - CGPoint currentPosition; - UITouch *touch = [touches anyObject]; - - switch ([touches count]) { - case 1: - currentPosition = [touch locationInView:self.view]; - // panning - CGFloat deltaX = fabsf(gestureStartPoint.x - currentPosition.x); - CGFloat deltaY = fabsf(gestureStartPoint.y - currentPosition.y); - - if (deltaX >= minimumGestureLength) { - NSLog(@"Horizontal swipe detected, deltaX: %f deltaY: %f",deltaX, deltaY); - if (currentPosition.x > gestureStartPoint.x) { - HW_cursorLeft(logCoeff*log(deltaX)); - } else { - HW_cursorRight(logCoeff*log(deltaX)); - } - - } - if (deltaY >= minimumGestureLength) { - NSLog(@"Horizontal swipe detected, deltaX: %f deltaY: %f",deltaX, deltaY); - if (currentPosition.y < gestureStartPoint.y) { - HW_cursorDown(logCoeff*log(deltaY)); - } else { - HW_cursorUp(logCoeff*log(deltaY)); - } - } - - break; - case 2: - twoTouches = [touches allObjects]; - UITouch *first = [twoTouches objectAtIndex:0]; - UITouch *second = [twoTouches objectAtIndex:1]; - CGFloat currentDistanceOfPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); - - if (0 == initialDistanceForPinching) - initialDistanceForPinching = currentDistanceOfPinching; - - if (currentDistanceOfPinching < initialDistanceForPinching + kMinimumPinchDelta) - HW_zoomOut(); - else if (currentDistanceOfPinching > initialDistanceForPinching + kMinimumPinchDelta) - HW_zoomIn(); - - currentDistanceOfPinching = initialDistanceForPinching; - break; - default: - break; - } -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/PopoverMenuViewController.h --- a/cocoaTouch/PopoverMenuViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -// -// popupMenuViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 25/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface PopoverMenuViewController : UITableViewController { - NSArray *menuList; - BOOL isPaused; -} -@property (nonatomic,retain) NSArray *menuList; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/PopoverMenuViewController.m --- a/cocoaTouch/PopoverMenuViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ - // -// popupMenuViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 25/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SDL_uikitappdelegate.h" -#import "PopoverMenuViewController.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" -#import "SDL_sysvideo.h" - -@implementation PopoverMenuViewController -@synthesize menuList; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; -} - --(void) viewDidLoad { - isPaused = NO; - - menuList = [[NSArray alloc] initWithObjects: - NSLocalizedString(@"Pause Game", @""), - NSLocalizedString(@"Chat", @""), - NSLocalizedString(@"End Game", @""), - nil]; - [super viewDidLoad]; -} - --(void) viewDidUnload { - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [menuList release]; - [super dealloc]; -} - -#pragma mark - -#pragma mark tableView methods --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 3; -} - --(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *cellIdentifier = @"CellIdentifier"; - - UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; - if (nil == cell) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:cellIdentifier] autorelease]; - } - cell.textLabel.text = [menuList objectAtIndex:[indexPath row]]; - - return cell; -} - --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - UIActionSheet *actionSheet; - - switch ([indexPath row]) { - case 0: - HW_pause(); - isPaused = !isPaused; - break; - case 1: - HW_chat(); - /* - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_VideoDisplay *display = &_this->displays[0]; - SDL_Window *window = display->windows; - SDL_iPhoneKeyboardShow(window); - */ - break; - case 2: - // expand the view (and table) so that the actionsheet can be selected on the iPhone - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - [self.tableView deselectRowAtIndexPath:indexPath animated:NO]; - [UIView beginAnimations:@"table width more" context:NULL]; - [UIView setAnimationDuration:0.2]; - self.view.frame = CGRectMake(0, 0, 480, 320); - [UIView commitAnimations]; - } - actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") - delegate:self - cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") - destructiveButtonTitle:NSLocalizedString(@"Of course!", @"") - otherButtonTitles:nil]; - [actionSheet showInView:self.view]; - [actionSheet release]; - - if (!isPaused) - HW_pause(); - break; - default: - NSLog(@"Warning: unset case value in section!"); - break; - } - - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark - -#pragma mark actionSheet methods --(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){ - [UIView beginAnimations:@"table width less" context:NULL]; - [UIView setAnimationDuration:0.2]; - self.view.frame = CGRectMake(280, 0, 200, 170); - [UIView commitAnimations]; - } - - if ([actionSheet cancelButtonIndex] != buttonIndex) { - [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissPopover" object:nil]; - HW_terminate(NO); - } - else - if (!isPaused) - HW_pause(); -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h --- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2010 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#import -#import "SDL_uikitopenglview.h" - -@class MainMenuViewController; -@class OverlayViewController; - -@interface SDLUIKitDelegate:NSObject { - SDL_Window *window; - UIWindow *uiwindow; - MainMenuViewController *mainViewController; - BOOL isInGame; -} - -@property (readwrite, assign) SDL_Window *window; -@property (readwrite, retain) UIWindow *uiwindow; - -+(SDLUIKitDelegate *)sharedAppDelegate; --(void) startSDLgame; --(void) displayOverlayLater; - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m --- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2009 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga, mods for Hedgewars by Vittorio Giovara - slouken@libsdl.org, vittorio.giovara@gmail.com -*/ - -#import "SDL_uikitappdelegate.h" -#import "SDL_uikitopenglview.h" -#import "SDL_uikitwindow.h" -#import "SDL_events_c.h" -#import "../SDL_sysvideo.h" -#import "jumphack.h" -#import "SDL_video.h" -#import "GameSetup.h" -#import "PascalImports.h" -#import "MainMenuViewController.h" -#import "OverlayViewController.h" -#import "CommodityFunctions.h" - -#ifdef main -#undef main -#endif - -#define VALGRIND "/opt/valgrind/bin/valgrind" - -int main (int argc, char *argv[]) { -#ifdef VALGRIND_REXEC - // Using the valgrind build config, rexec ourself in valgrind - // from http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html - if (argc < 2 || (argc >= 2 && strcmp(argv[1], "-valgrind") != 0)) - execl(VALGRIND, VALGRIND, "--leak-check=full", argv[0], "-valgrind", NULL); -#endif - - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, @"SDLUIKitDelegate"); - [pool release]; - return retVal; -} - -@implementation SDLUIKitDelegate -@synthesize uiwindow, window; - -// convenience method -+(SDLUIKitDelegate *)sharedAppDelegate { - // the delegate is set in UIApplicationMain(), which is guaranteed to be called before this method - return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate]; -} - --(id) init { - if (self = [super init]){ - mainViewController = nil; - isInGame = NO; - self.uiwindow = nil; - self.window = NULL; - } - return self; -} - --(void) dealloc { - SDL_DestroyWindow(self.window); - [uiwindow release]; - [mainViewController release]; - [super dealloc]; -} - -// main routine for calling the actual game engine --(IBAction) startSDLgame { - [UIView beginAnimations:@"removing main controller" context:NULL]; - [UIView setAnimationDuration:1]; - mainViewController.view.alpha = 0; - [UIView commitAnimations]; - - // pull out useful configuration info from various files - GameSetup *setup = [[GameSetup alloc] init]; - [setup startThread:@"engineProtocol"]; - const char **gameArgs = [setup getSettings]; - [setup release]; - - // since the sdlwindow is not yet created, we add the overlayController with a delay - [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:1]; - - // this is the pascal fuction that starts the game (wrapped around isInGame) - isInGame = YES; - Game(gameArgs); - isInGame = NO; - - free(gameArgs); - - [UIView beginAnimations:@"inserting main controller" context:NULL]; - [UIView setAnimationDuration:1]; - mainViewController.view.alpha = 1; - [UIView commitAnimations]; -} - --(void) displayOverlayLater { - // overlay with controls, become visible after 4 seconds, with a transparency effect - OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; - - [[[UIApplication sharedApplication] keyWindow] addSubview:overlayController.view]; - [overlayController release]; -} - -// override the direct execution of SDL_main to allow us to implement the frontend (or even using a nib) --(void) applicationDidFinishLaunching:(UIApplication *)application { - [application setStatusBarHidden:YES]; - [application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; - - uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - uiwindow.backgroundColor = [UIColor blackColor]; - // needed to keep the app running after a game (gets released in sdl_uikitwindow) - [uiwindow retain]; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil]; - else - mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil]; - - [uiwindow addSubview:mainViewController.view]; - [uiwindow makeKeyAndVisible]; - - // Set working directory to resource path - [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; -} - --(void) applicationWillTerminate:(UIApplication *)application { - SDL_SendQuit(); - if (isInGame) { - HW_terminate(YES); - // hack to prevent automatic termination. See SDL_uikitevents.m for details - longjmp(*(jump_env()), 1); - } -} - --(void) applicationWillResignActive:(UIApplication *)application { - //NSLog(@"%@", NSStringFromSelector(_cmd)); - if (isInGame) { - HW_pause(); - - /* - // Send every window on every screen a MINIMIZED event. - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (!_this) - return; - - int i; - for (i = 0; i < _this->num_displays; i++) { - const SDL_VideoDisplay *display = &_this->displays[i]; - SDL_Window *window; - for (window = display->windows; window != nil; window = window->next) - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - */ - } -} - --(void) applicationDidBecomeActive:(UIApplication *)application { - //NSLog(@"%@", NSStringFromSelector(_cmd)); - if (isInGame) { - HW_pause(); - - /* - // Send every window on every screen a RESTORED event. - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (!_this) - return; - - int i; - for (i = 0; i < _this->num_displays; i++) { - const SDL_VideoDisplay *display = &_this->displays[i]; - SDL_Window *window; - for (window = display->windows; window != nil; window = window->next) - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - */ - } -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SchemeSettingsViewController.h --- a/cocoaTouch/SchemeSettingsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -// -// SchemeSettingsViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 19/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import -@class SingleSchemeViewController; - -@interface SchemeSettingsViewController : UITableViewController { - NSMutableArray *listOfSchemes; - SingleSchemeViewController *childController; -} - -@property (nonatomic, retain) NSMutableArray *listOfSchemes; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SchemeSettingsViewController.m --- a/cocoaTouch/SchemeSettingsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -// -// SchemeSettingsViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 19/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SchemeSettingsViewController.h" -#import "CommodityFunctions.h" -#import "SingleSchemeViewController.h" - -@implementation SchemeSettingsViewController -@synthesize listOfSchemes; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the scheme panel") - style:UIBarButtonItemStyleBordered - target:self - action:@selector(toggleEdit:)]; - self.navigationItem.rightBarButtonItem = editButton; - [editButton release]; - -} - --(void) viewWillAppear:(BOOL) animated { - [super viewWillAppear:animated]; - - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; - NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; - self.listOfSchemes = array; - [array release]; - - [self.tableView reloadData]; -} - -// modifies the navigation bar to add the "Add" and "Done" buttons --(void) toggleEdit:(id) sender { - BOOL isEditing = self.tableView.editing; - [self.tableView setEditing:!isEditing animated:YES]; - - if (isEditing) { - [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the scheme panel")]; - [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered]; - self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem; - } else { - [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Done",@"from the scheme panel")]; - [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone]; - UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Add",@"from the scheme panel") - style:UIBarButtonItemStyleBordered - target:self - action:@selector(addScheme:)]; - self.navigationItem.leftBarButtonItem = addButton; - [addButton release]; - } -} - --(void) addScheme:(id) sender { - NSString *fileName = [[NSString alloc] initWithFormat:@"Scheme %u.plist", [self.listOfSchemes count]]; - - createSchemeNamed([fileName stringByDeletingPathExtension]); - - [self.listOfSchemes addObject:fileName]; - [fileName release]; - - // order the array alphabetically, so schemes will keep their position - [self.listOfSchemes sortUsingSelector:@selector(compare:)]; - - [self.tableView reloadData]; -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.listOfSchemes count]; -} - --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - NSUInteger row = [indexPath row]; - NSString *rowString = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension]; - cell.textLabel.text = rowString; - cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - - return cell; -} - -// delete the row and the file --(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - NSUInteger row = [indexPath row]; - - NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]]; - [[NSFileManager defaultManager] removeItemAtPath:schemeFile error:NULL]; - [schemeFile release]; - - [self.listOfSchemes removeObjectAtIndex:row]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; -} - -#pragma mark - -#pragma mark Table view delegate - --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (childController == nil) { - childController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped]; - } - - NSInteger row = [indexPath row]; - NSString *selectedSchemeFile = [self.listOfSchemes objectAtIndex:row]; - - // this must be set so childController can load the correct plist - childController.title = [selectedSchemeFile stringByDeletingPathExtension]; - [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; - - [self.navigationController pushViewController:childController animated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - if (childController.view.superview == nil ) - childController = nil; -} - --(void) viewDidUnload { - self.listOfSchemes = nil; - childController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - - --(void) dealloc { - [self.listOfSchemes release]; - [childController release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SchemeWeaponConfigViewController.h --- a/cocoaTouch/SchemeWeaponConfigViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// -// SchemeWeaponConfigViewController.h -// Hedgewars -// -// Created by Vittorio on 13/06/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface SchemeWeaponConfigViewController : UITableViewController { - NSArray *listOfSchemes; - NSArray *listOfWeapons; - - NSIndexPath *lastIndexPath; - NSString *selectedScheme; - NSString *selectedWeapon; -} - -@property (nonatomic, retain) NSArray *listOfSchemes; -@property (nonatomic, retain) NSArray *listOfWeapons; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; -@property (nonatomic,retain) NSString *selectedScheme; -@property (nonatomic,retain) NSString *selectedWeapon; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SchemeWeaponConfigViewController.m --- a/cocoaTouch/SchemeWeaponConfigViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -// -// SchemeWeaponConfigViewController.m -// Hedgewars -// -// Created by Vittorio on 13/06/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SchemeWeaponConfigViewController.h" -#import "CommodityFunctions.h" - -@implementation SchemeWeaponConfigViewController -@synthesize listOfSchemes, listOfWeapons, lastIndexPath, selectedScheme, selectedWeapon; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); - - self.selectedScheme = @"Default.plist"; - self.selectedWeapon = @"Default.plist"; -} - --(void) viewWillAppear:(BOOL) animated { - [super viewWillAppear:animated]; - - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; - self.listOfSchemes = contentsOfDir; - - [self.tableView reloadData]; -} - -/* -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; -} -*/ -/* -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; -} -*/ -/* -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; -} -*/ - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 2; -} - - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == 0) - return [self.listOfSchemes count]; - else - return [self.listOfWeapons count]; -} - - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - NSInteger row = [indexPath row]; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - cell.accessoryType = UITableViewCellAccessoryNone; - if ([indexPath section] == 0) { - cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension]; - if ([[self.listOfSchemes objectAtIndex:row] isEqualToString:self.selectedScheme]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } - } else { - cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension]; - if ([[self.listOfWeapons objectAtIndex:row] isEqualToString:self.selectedWeapon]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - //TODO: this code works only for a single section table - UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; - newCell.accessoryType = UITableViewCellAccessoryCheckmark; - UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; - oldCell.accessoryType = UITableViewCellAccessoryNone; - self.lastIndexPath = indexPath; - self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow]; - [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - --(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger) section { - if (section == 0) { - return NSLocalizedString(@"Schemes",@""); - } else { - return NSLocalizedString(@"Weapons",@"");; - } -} - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.listOfSchemes = nil; - self.listOfWeapons = nil; - self.lastIndexPath = nil; - self.selectedScheme = nil; - self.selectedWeapon = nil; - MSG_DIDUNLOAD(); -} - - --(void) dealloc { - [listOfSchemes release]; - [listOfWeapons release]; - [lastIndexPath release]; - [selectedScheme release]; - [selectedWeapon release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SingleSchemeViewController.h --- a/cocoaTouch/SingleSchemeViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// SingleSchemeViewController.h -// Hedgewars -// -// Created by Vittorio on 23/05/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface SingleSchemeViewController : UITableViewController { - UITextField *textFieldBeingEdited; - NSMutableArray *schemeArray; - - NSArray *basicSettingList; - NSArray *gameModifierArray; -} - -@property (nonatomic, retain) UITextField *textFieldBeingEdited; -@property (nonatomic, retain) NSMutableArray *schemeArray; -@property (nonatomic, retain) NSArray *basicSettingList; -@property (nonatomic, retain) NSArray *gameModifierArray; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SingleSchemeViewController.m --- a/cocoaTouch/SingleSchemeViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +0,0 @@ -// -// SingleSchemeViewController.m -// Hedgewars -// -// Created by Vittorio on 23/05/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SingleSchemeViewController.h" -#import -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation SingleSchemeViewController -@synthesize textFieldBeingEdited, schemeArray, basicSettingList, gameModifierArray; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - NSArray *mods = [[NSArray alloc] initWithObjects: - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Fort Mode",@""),@"title", - NSLocalizedString(@"Defend your fort and destroy the opponents (two team colours max)",@""),@"description", - @"Forts",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Divide Team",@""),@"title", - NSLocalizedString(@"Teams will start on opposite sides of the terrain (two team colours max)",@""),@"description", - @"TeamsDivide",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Solid Land",@""),@"title", - NSLocalizedString(@"Land can not be destroyed",@""),@"description", - @"Solid",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Border",@""),@"title", - NSLocalizedString(@"Add an indestructable border around the terrain",@""),@"description", - @"Border",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Low Gravity",@""),@"title", - NSLocalizedString(@"Lower gravity",@""),@"description", - @"LowGravity",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Laser Sight",@""),@"title", - NSLocalizedString(@"Assisted aiming with laser sight",@""),@"description", - @"LaserSight",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Invulnerable",@""),@"title", - NSLocalizedString(@"All hogs have a personal forcefield",@""),@"description", - @"Invulnerable",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Mines",@""),@"title", - NSLocalizedString(@"Enable random mines",@""),@"description", - @"Mines",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Vampirism Mode",@""),@"title", - NSLocalizedString(@"Gain 80% of the damage you do back in health",@""),@"description", - @"Vampiric",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Karma Mode",@""),@"title", - NSLocalizedString(@"Share your opponents pain, share their damage",@""),@"description", - @"Karma",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Artillery Mode",@""),@"title", - NSLocalizedString(@"Your hogs are unable to move, test your aim",@""),@"description", - @"Artillery",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Random Order",@""),@"title", - NSLocalizedString(@"Order of play is random instead of in room order",@""),@"description", - @"RandomOrder",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"King Mode",@""),@"title", - NSLocalizedString(@"Play with a King. If he dies, your side loses",@""),@"description", - @"King",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"Place Hedgehogs",@""),@"title", - NSLocalizedString(@"Take turns placing your hedgehogs pre-game",@""),@"description", - @"PlaceHog",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Clan Shares Ammo",@""),@"title", - NSLocalizedString(@"Ammo is shared between all clan teams",@""),@"description", - @"SharedAmmo",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Girders",@""),@"title", - NSLocalizedString(@"Disable girders when generating random maps",@""),@"description", - @"DisableGirders",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Land Objects",@""),@"title", - NSLocalizedString(@"Disable land objects when generating maps",@""),@"description", - @"DisableLandObjects",@"image",nil], - nil]; - self.gameModifierArray = mods; - [mods release]; - - NSArray *basicSettings = [[NSArray alloc] initWithObjects: - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Damage Modifier",@""),@"title",@"Damage",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Turn Time",@""),@"title",@"Time",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Initial Health",@""),@"title",@"Health",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Sudden Death Timeout",@""),@"title",@"SuddenDeath",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Crate Drops",@""),@"title",@"Box",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Time",@""),@"title",@"Time",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Number",@""),@"title",@"Mine",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Dud Mines Probability",@""),@"title",@"Dud",@"image",nil], - [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Explosives",@""),@"title",@"Damage",@"image",nil], - nil]; - self.basicSettingList = basicSettings; - [basicSettings release]; -} - -// load from file --(void) viewWillAppear:(BOOL) animated { - [super viewWillAppear:animated]; - - NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title]; - NSMutableArray *scheme = [[NSMutableArray alloc] initWithContentsOfFile:schemeFile]; - self.schemeArray = scheme; - [scheme release]; - [schemeFile release]; - - [self.tableView reloadData]; -} - -// save to file --(void) viewWillDisappear:(BOOL) animated { - [super viewWillDisappear:animated]; - - NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title]; - [self.schemeArray writeToFile:schemeFile atomically:YES]; - [schemeFile release]; -} - -#pragma mark - -#pragma mark textfield methods --(void) cancel:(id) sender { - if (textFieldBeingEdited != nil) - [self.textFieldBeingEdited resignFirstResponder]; -} - -// set the new value --(BOOL) save:(id) sender { - if (textFieldBeingEdited != nil) { - [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title] error:NULL]; - self.title = self.textFieldBeingEdited.text; - [self.schemeArray writeToFile:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title] atomically:YES]; - [self.textFieldBeingEdited resignFirstResponder]; - return YES; - } - return NO; -} - -// the textfield is being modified, update the navigation controller --(void) textFieldDidBeginEditing:(UITextField *)aTextField{ - self.textFieldBeingEdited = aTextField; - - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from schemes table") - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancel:)]; - self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; - - UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from schemes table") - style:UIBarButtonItemStyleDone - target:self - action:@selector(save:)]; - self.navigationItem.rightBarButtonItem = saveButton; - [saveButton release]; -} - -// the textfield has been modified, check for empty strings and restore original navigation bar --(void) textFieldDidEndEditing:(UITextField *)aTextField{ - if ([textFieldBeingEdited.text length] == 0) - textFieldBeingEdited.text = [NSString stringWithFormat:@"New Scheme"]; - - self.textFieldBeingEdited = nil; - self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; - self.navigationItem.leftBarButtonItem = nil; -} - -// limit the size of the field to 64 characters like in original frontend --(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - int limit = 64; - return !([textField.text length] > limit && [string length] > range.length); -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 3; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - switch (section) { - case 0: - return 1; - break; - case 1: - return [self.basicSettingList count]; - break; - case 2: - return [self.gameModifierArray count]; - default: - break; - } - return 0; -} - --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier0 = @"Cell0"; - static NSString *CellIdentifier1 = @"Cell1"; - static NSString *CellIdentifier2 = @"Cell2"; - - UITableViewCell *cell = nil; - NSInteger row = [indexPath row]; - - switch ([indexPath section]) { - case 0: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier0] autorelease]; - // create a uitextfield for each row, expand it to take the maximum size - UITextField *aTextField = [[UITextField alloc] - initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; - aTextField.clearsOnBeginEditing = NO; - aTextField.returnKeyType = UIReturnKeyDone; - aTextField.adjustsFontSizeToFitWidth = YES; - aTextField.delegate = self; - aTextField.tag = [indexPath row]; - aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; - aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; - [cell.contentView addSubview:aTextField]; - [aTextField release]; - } - - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - // we find the uitextfied and we'll use its tag to understand which one is being edited - UITextField *textFieldFound = (UITextField *)oneView; - textFieldFound.text = self.title; - } - } - cell.detailTextLabel.text = nil; - cell.imageView.image = nil; - break; - case 1: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier1] autorelease]; - } - - UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",BTN_DIRECTORY(),[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]]; - cell.imageView.image = [img scaleToSize:CGSizeMake(40, 40)]; - [img release]; - cell.textLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"]; - cell.detailTextLabel.text = nil; - break; - case 2: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle - reuseIdentifier:CellIdentifier2] autorelease]; - UISwitch *onOff = [[UISwitch alloc] init]; - onOff.tag = row; - [onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged]; - cell.accessoryView = onOff; - [onOff release]; - } - - UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",BTN_DIRECTORY(),[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]]; - cell.imageView.image = image; - [image release]; - [cell.imageView.layer setCornerRadius:7.0f]; - [cell.imageView.layer setMasksToBounds:YES]; - cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"]; - cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"]; - [(UISwitch *)cell.accessoryView setOn:[[self.schemeArray objectAtIndex:row] boolValue] animated:NO]; - } - - return cell; -} - --(void) toggleSwitch:(id) sender { - UISwitch *theSwitch = (UISwitch *)sender; - [self.schemeArray replaceObjectAtIndex:theSwitch.tag withObject:[NSNumber numberWithBool:theSwitch.on]]; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - - if ([indexPath section] == 0) { - UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath]; - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - textFieldBeingEdited = (UITextField *)oneView; - [textFieldBeingEdited becomeFirstResponder]; - } - } - } - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - --(void) viewDidUnload { - self.textFieldBeingEdited = nil; - self.schemeArray = nil; - self.basicSettingList = nil; - self.gameModifierArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [textFieldBeingEdited release]; - [schemeArray release]; - [basicSettingList release]; - [gameModifierArray release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SingleTeamViewController.h --- a/cocoaTouch/SingleTeamViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -// -// SingleTeamViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class HogHatViewController; -@class GravesViewController; -@class VoicesViewController; -@class FortsViewController; -@class FlagsViewController; -@class LevelViewController; -@interface SingleTeamViewController : UITableViewController { - NSMutableDictionary *teamDictionary; - - UITextField *textFieldBeingEdited; - NSString *teamName; - UIImage *normalHogSprite; - - NSArray *secondaryItems; - BOOL isWriteNeeded; - - HogHatViewController *hogHatViewController; - GravesViewController *gravesViewController; - VoicesViewController *voicesViewController; - FortsViewController *fortsViewController; - FlagsViewController *flagsViewController; - LevelViewController *levelViewController; -} - -@property (nonatomic,retain) NSMutableDictionary *teamDictionary; -@property (nonatomic,retain) UITextField *textFieldBeingEdited; -@property (nonatomic,retain) NSString *teamName; -@property (nonatomic,retain) UIImage *normalHogSprite; -@property (nonatomic,retain) NSArray *secondaryItems; - --(void) writeFile; --(void) setWriteNeeded; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SingleTeamViewController.m --- a/cocoaTouch/SingleTeamViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,453 +0,0 @@ -// -// SingleTeamViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SingleTeamViewController.h" -#import "HogHatViewController.h" -#import "GravesViewController.h" -#import "VoicesViewController.h" -#import "FortsViewController.h" -#import "FlagsViewController.h" -#import "LevelViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -#define TEAMNAME_TAG 1234 - -@implementation SingleTeamViewController -@synthesize teamDictionary, normalHogSprite, secondaryItems, textFieldBeingEdited, teamName; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark textfield methods --(void) cancel:(id) sender { - if (textFieldBeingEdited != nil) - [self.textFieldBeingEdited resignFirstResponder]; -} - -// set the new value --(BOOL) save:(id) sender { - NSInteger index = textFieldBeingEdited.tag; - - if (textFieldBeingEdited != nil) { - if (TEAMNAME_TAG == index) { - [self.teamDictionary setObject:textFieldBeingEdited.text forKey:@"teamname"]; - } else { - //replace the old value with the new one - NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:index]; - [hog setObject:textFieldBeingEdited.text forKey:@"hogname"]; - } - - isWriteNeeded = YES; - [self.textFieldBeingEdited resignFirstResponder]; - return YES; - } - return NO; -} - -// the textfield is being modified, update the navigation controller --(void) textFieldDidBeginEditing:(UITextField *)aTextField{ - self.textFieldBeingEdited = aTextField; - - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from the hog name table") - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancel:)]; - self.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; - - UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from the hog name table") - style:UIBarButtonItemStyleDone - target:self - action:@selector(save:)]; - self.navigationItem.rightBarButtonItem = saveButton; - [saveButton release]; -} - -// the textfield has been modified, check for empty strings and restore original navigation bar --(void) textFieldDidEndEditing:(UITextField *)aTextField{ - if ([textFieldBeingEdited.text length] == 0) - textFieldBeingEdited.text = [NSString stringWithFormat:@"hedgehog %d",textFieldBeingEdited.tag]; - - self.textFieldBeingEdited = nil; - self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; - self.navigationItem.leftBarButtonItem = nil; -} - -// limit the size of the field to 64 characters like in original frontend --(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - int limit = 64; - return !([textField.text length] > limit && [string length] > range.length); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - // labels for the entries - NSArray *array = [[NSArray alloc] initWithObjects: - NSLocalizedString(@"Grave",@""), - NSLocalizedString(@"Voice",@""), - NSLocalizedString(@"Fort",@""), - NSLocalizedString(@"Flag",@""), - NSLocalizedString(@"Level",@""),nil]; - self.secondaryItems = array; - [array release]; - - // load the base hog image, drawing will occure in cellForRow... - NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; - UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; - [normalHogFile release]; - self.normalHogSprite = hogSprite; - [hogSprite release]; - - // listen if any childController modifies the plist and write it if needed - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil]; - isWriteNeeded = NO; -} - --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - // load data about the team and write if there has been a change - if (isWriteNeeded) - [self writeFile]; - - NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; - NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile]; - self.teamDictionary = teamDict; - [teamDict release]; - [teamFile release]; - - self.teamName = self.title; - - [self.tableView reloadData]; -} - -// write on file if there has been a change --(void) viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - - // end the editing of the current field - if (textFieldBeingEdited != nil) { - [self save:nil]; - } - - if (isWriteNeeded) - [self writeFile]; -} - -#pragma mark - -// needed by other classes to warn about a user change --(void) setWriteNeeded { - isWriteNeeded = YES; -} - --(void) writeFile { - NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; - - NSString *newTeamName = [self.teamDictionary objectForKey:@"teamname"]; - if (![newTeamName isEqualToString:self.teamName]) { - //delete old - [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL]; - [teamFile release]; - self.title = newTeamName; - self.teamName = newTeamName; - teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),newTeamName]; - } - - [self.teamDictionary writeToFile:teamFile atomically:YES]; - NSLog(@"writing: %@",teamDictionary); - isWriteNeeded = NO; - [teamFile release]; -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 3; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - NSInteger rows = 0; - switch (section) { - case 0: // team name - rows = 1; - break; - case 1: // team members - rows = MAX_HOGS; - break; - case 2: // team details - rows = [self.secondaryItems count]; - break; - default: - break; - } - return rows; -} - --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier0 = @"Cell0"; - static NSString *CellIdentifier1 = @"Cell1"; - static NSString *CellIdentifier2 = @"Cell2"; - - NSArray *hogArray; - UITableViewCell *cell = nil; - NSInteger row = [indexPath row]; - UIImage *accessoryImage; - - switch ([indexPath section]) { - case 0: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier0] autorelease]; - // create a uitextfield for each row, expand it to take the maximum size - UITextField *aTextField = [[UITextField alloc] - initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; - aTextField.clearsOnBeginEditing = NO; - aTextField.returnKeyType = UIReturnKeyDone; - aTextField.adjustsFontSizeToFitWidth = YES; - aTextField.delegate = self; - aTextField.tag = [indexPath row]; - aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; - aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; - [cell.contentView addSubview:aTextField]; - [aTextField release]; - } - - cell.imageView.image = nil; - cell.accessoryType = UITableViewCellAccessoryNone; - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - // we find the uitextfied and we'll use its tag to understand which one is being edited - UITextField *textFieldFound = (UITextField *)oneView; - textFieldFound.text = [self.teamDictionary objectForKey:@"teamname"]; - textFieldFound.tag = TEAMNAME_TAG; - } - } - break; - case 1: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier1] autorelease]; - - // create a uitextfield for each row, expand it to take the maximum size - UITextField *aTextField = [[UITextField alloc] - initWithFrame:CGRectMake(42, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; - aTextField.clearsOnBeginEditing = NO; - aTextField.returnKeyType = UIReturnKeyDone; - aTextField.adjustsFontSizeToFitWidth = YES; - aTextField.delegate = self; - aTextField.tag = [indexPath row]; - aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; - aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; - [cell.contentView addSubview:aTextField]; - [aTextField release]; - } - - hogArray = [self.teamDictionary objectForKey:@"hedgehogs"]; - - NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@.png", HATS_DIRECTORY(), [[hogArray objectAtIndex:row] objectForKey:@"hat"]]; - UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; - [hatFile release]; - cell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)]; - [hatSprite release]; - - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - // we find the uitextfied and we'll use its tag to understand which one is being edited - UITextField *textFieldFound = (UITextField *)oneView; - textFieldFound.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"]; - } - } - - cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; - break; - case 2: - cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:CellIdentifier2] autorelease]; - } - - cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; - cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - switch (row) { - case 0: // grave - accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", - GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] - andCutAt:CGRectMake(0,0,32,32)]; - cell.imageView.image = accessoryImage; - [accessoryImage release]; - break; - case 2: // fort - accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@L.png", - FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; - cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(42, 42)]; - [accessoryImage release]; - break; - - case 3: // flags - accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", - FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; - cell.imageView.image = accessoryImage; - [accessoryImage release]; - break; - case 4: // level - accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", - BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] - objectAtIndex:0] objectForKey:@"level"] - intValue]]]; - cell.imageView.image = accessoryImage; - [accessoryImage release]; - break; - default: - cell.imageView.image = nil; - break; - } - break; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSInteger row = [indexPath row]; - NSInteger section = [indexPath section]; - UITableViewController *nextController = nil; - UITableViewCell *cell; - - if (2 == section) { - switch (row) { - case 0: // grave - if (nil == gravesViewController) - gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - nextController = gravesViewController; - break; - case 1: // voice - if (nil == voicesViewController) - voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - nextController = voicesViewController; - break; - case 2: // fort - if (nil == fortsViewController) - fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - nextController = fortsViewController; - break; - case 3: // flag - if (nil == flagsViewController) - flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - nextController = flagsViewController; - break; - case 4: // level - if (nil == levelViewController) - levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - nextController = levelViewController; - break; - } - - nextController.title = [secondaryItems objectAtIndex:row]; - [nextController setTeamDictionary:teamDictionary]; - [self.navigationController pushViewController:nextController animated:YES]; - } else { - cell = [aTableView cellForRowAtIndexPath:indexPath]; - for (UIView *oneView in cell.contentView.subviews) { - if ([oneView isMemberOfClass:[UITextField class]]) { - textFieldBeingEdited = (UITextField *)oneView; - [textFieldBeingEdited becomeFirstResponder]; - } - } - [aTableView deselectRowAtIndexPath:indexPath animated:NO]; - } - -} - -// action to perform when you want to change a hog hat --(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { - if (nil == hogHatViewController) { - hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped]; - } - - // cache the dictionary file of the team, so that other controllers can modify it - hogHatViewController.teamDictionary = self.teamDictionary; - hogHatViewController.selectedHog = [indexPath row]; - - [self.navigationController pushViewController:hogHatViewController animated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. - if (hogHatViewController.view.superview == nil) - hogHatViewController = nil; - if (gravesViewController.view.superview == nil) - gravesViewController = nil; - if (voicesViewController.view.superview == nil) - voicesViewController = nil; - if (fortsViewController.view.superview == nil) - fortsViewController = nil; - if (flagsViewController.view.superview == nil) - flagsViewController = nil; - if (levelViewController.view.superview == nil) - levelViewController = nil; -} - --(void) viewDidUnload { - self.teamDictionary = nil; - self.textFieldBeingEdited = nil; - self.teamName = nil; - self.normalHogSprite = nil; - self.secondaryItems = nil; - hogHatViewController = nil; - flagsViewController = nil; - fortsViewController = nil; - gravesViewController = nil; - levelViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [teamDictionary release]; - [textFieldBeingEdited release]; - [teamName release]; - [normalHogSprite release]; - [secondaryItems release]; - [hogHatViewController release]; - [fortsViewController release]; - [gravesViewController release]; - [flagsViewController release]; - [levelViewController release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SplitViewRootController.h --- a/cocoaTouch/SplitViewRootController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -// -// SplitViewRootController.h -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@class DetailViewController; -@interface SplitViewRootController: UIViewController { - DetailViewController *detailViewController; -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/SplitViewRootController.m --- a/cocoaTouch/SplitViewRootController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ - // -// SplitViewRootController.m -// HedgewarsMobile -// -// Created by Vittorio on 27/03/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SplitViewRootController.h" -#import "MasterViewController.h" -#import "DetailViewController.h" -#import "CommodityFunctions.h" - -@implementation SplitViewRootController - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Release any cached data, images, etc that aren't in use. - if (detailViewController.view.superview == nil) - detailViewController = nil; - MSG_MEMCLEAN(); -} - -// load the view programmatically; we need a splitViewController that handles a MasterViewController -// (which is just a UITableViewController) and a DetailViewController where we present options --(void) viewDidLoad { - detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; - UINavigationController *detailedNavController = [[UINavigationController alloc] initWithRootViewController:detailViewController]; - [detailViewController release]; - - CGRect rect = [[UIScreen mainScreen] bounds]; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - - Class splitViewControllerClass = NSClassFromString(@"UISplitViewController"); - if (splitViewControllerClass) { -#if __IPHONE_3_2 - UISplitViewController *splitViewRootController = [[UISplitViewController alloc] init]; - //splitViewRootController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - splitViewRootController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - - MasterViewController *masterViewController = [[MasterViewController alloc] initWithStyle:UITableViewStylePlain]; - UINavigationController *mainNavController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; - [masterViewController release]; - - splitViewRootController.delegate = detailViewController; - masterViewController.detailViewController = detailViewController; - splitViewRootController.viewControllers = [NSArray arrayWithObjects: mainNavController, detailedNavController, nil]; - [mainNavController release]; - [detailedNavController release]; - - // add view to main controller - [self.view addSubview:splitViewRootController.view]; -#endif - } else { - [self.view addSubview:detailedNavController.view]; - } - - [super viewDidLoad]; -} - --(void) viewDidUnload { - detailViewController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [detailViewController release]; - [super dealloc]; -} --(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ - [detailViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; -} - -#pragma mark - -#pragma mark additional methods as we're using a UINavigationController programmatically -// see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/ --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [detailViewController.navigationController viewWillAppear:animated]; -} - --(void) viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - [detailViewController.navigationController viewWillDisappear:animated]; -} - --(void) viewDidAppear:(BOOL)animated { - [super viewDidLoad]; - [detailViewController.navigationController viewDidAppear:animated]; -} - --(void) viewDidDisappear:(BOOL)animated { - [super viewDidUnload]; - [detailViewController.navigationController viewDidDisappear:animated]; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/TeamConfigViewController.h --- a/cocoaTouch/TeamConfigViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -// -// TeamConfigViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface TeamConfigViewController : UITableViewController { - NSMutableArray *listOfTeams; - NSMutableArray *listOfSelectedTeams; -} - -@property (nonatomic, retain) NSMutableArray *listOfTeams; -@property (nonatomic, retain) NSMutableArray *listOfSelectedTeams; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/TeamConfigViewController.m --- a/cocoaTouch/TeamConfigViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -// -// TeamConfigViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "TeamConfigViewController.h" -#import "CommodityFunctions.h" -#import "HogButtonView.h" -#import "SquareButtonView.h" - -@implementation TeamConfigViewController -@synthesize listOfTeams, listOfSelectedTeams; - -#define NUMBERBUTTON_TAG 123456 -#define SQUAREBUTTON_TAG 654321 -#define LABEL_TAG 456123 - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); -} - --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - // integer representation of various color (defined in SquareButtonView) - NSUInteger colors[6] = { 4421353, 4100897, 10632635, 16749353, 14483456, 7566195 }; - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; - NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]]; - for (int i = 0; i < [contentsOfDir count]; i++) { - NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [contentsOfDir objectAtIndex:i],@"team", - [NSNumber numberWithInt:4],@"number", - [NSNumber numberWithInt:colors[i%6]],@"color",nil]; - [array addObject:dict]; - [dict release]; - } - self.listOfTeams = array; - [array release]; - - NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil]; - self.listOfSelectedTeams = emptyArray; - [emptyArray release]; - - [self.tableView reloadData]; -} - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 2; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == 0) - return [listOfSelectedTeams count] ; - else - return [listOfTeams count]; -} - --(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section { - if (section == 0) - return NSLocalizedString(@"Playing Teams",@""); - else - return NSLocalizedString(@"Available Teams",@""); -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier0 = @"Cell0"; - static NSString *CellIdentifier1 = @"Cell1"; - NSInteger section = [indexPath section]; - UITableViewCell *cell; - - if (section == 0) { - cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; - - UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)]; - numberButton.tag = NUMBERBUTTON_TAG; - [cell addSubview:numberButton]; - [numberButton release]; - - SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)]; - squareButton.tag = SQUAREBUTTON_TAG; - [cell addSubview:squareButton]; - [squareButton release]; - - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)]; - label.textAlignment = UITextAlignmentLeft; - label.backgroundColor = [UIColor clearColor]; - label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; - label.tag = LABEL_TAG; - [cell.contentView addSubview:label]; - [label release]; - } - - NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]]; - - UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG]; - cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; - - HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG]; - [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]]; - numberButton.ownerDictionary = selectedRow; - - SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG]; - [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; - squareButton.ownerDictionary = selectedRow; - } else { - cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; - - cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSInteger row = [indexPath row]; - NSInteger section = [indexPath section]; - - if (section == 0) { - [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; - [self.listOfSelectedTeams removeObjectAtIndex:row]; - } else { - [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]]; - [self.listOfTeams removeObjectAtIndex:row]; - } - [aTableView reloadData]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - self.listOfTeams = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - - --(void) dealloc { - [self.listOfTeams release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/TeamSettingsViewController.h --- a/cocoaTouch/TeamSettingsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -// -// TeamSettingsViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import -@class SingleTeamViewController; - -@interface TeamSettingsViewController : UITableViewController { - NSMutableArray *listOfTeams; - SingleTeamViewController *childController; -} - -@property (nonatomic, retain) NSMutableArray *listOfTeams; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/TeamSettingsViewController.m --- a/cocoaTouch/TeamSettingsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -// -// TeamSettingsViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "TeamSettingsViewController.h" -#import "SingleTeamViewController.h" -#import "CommodityFunctions.h" - -@implementation TeamSettingsViewController -@synthesize listOfTeams; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle -// add an edit button --(void) viewDidLoad { - [super viewDidLoad]; - - UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the team panel") - style:UIBarButtonItemStyleBordered - target:self - action:@selector(toggleEdit:)]; - self.navigationItem.rightBarButtonItem = editButton; - [editButton release]; -} - -// load the list of teams in the teams directory --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; - NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; - self.listOfTeams = array; - [array release]; - - [self.tableView reloadData]; -} - -// modifies the navigation bar to add the "Add" and "Done" buttons --(void) toggleEdit:(id) sender { - BOOL isEditing = self.tableView.editing; - [self.tableView setEditing:!isEditing animated:YES]; - - if (isEditing) { - [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the team panel")]; - [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered]; - self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem; - } else { - [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Done",@"from the team panel")]; - [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone]; - UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Add",@"from the team panel") - style:UIBarButtonItemStyleBordered - target:self - action:@selector(addTeam:)]; - self.navigationItem.leftBarButtonItem = addButton; - [addButton release]; - } -} - -// add a team file with default values and updates the table --(void) addTeam:(id) sender { - NSString *fileName = [[NSString alloc] initWithFormat:@"Default Team %u.plist", [self.listOfTeams count]]; - - createTeamNamed([fileName stringByDeletingPathExtension]); - - [self.listOfTeams addObject:fileName]; - [fileName release]; - - // order the array alphabetically, so teams will keep their position - [self.listOfTeams sortUsingSelector:@selector(compare:)]; - - [self.tableView reloadData]; -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.listOfTeams count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - NSUInteger row = [indexPath row]; - NSString *rowString = [[self.listOfTeams objectAtIndex:row] stringByDeletingPathExtension]; - cell.textLabel.text = rowString; - cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - - return cell; -} - -// delete the row and the file --(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - NSUInteger row = [indexPath row]; - - NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[self.listOfTeams objectAtIndex:row]]; - [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL]; - [teamFile release]; - - [self.listOfTeams removeObjectAtIndex:row]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if (childController == nil) { - childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped]; - } - - NSInteger row = [indexPath row]; - NSString *selectedTeamFile = [listOfTeams objectAtIndex:row]; - - // this must be set so childController can load the correct plist - childController.title = [selectedTeamFile stringByDeletingPathExtension]; - [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; - - [self.navigationController pushViewController:childController animated:YES]; -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. - if (childController.view.superview == nil ) - childController = nil; -} - --(void) viewDidUnload { - self.listOfTeams = nil; - childController = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [self.listOfTeams release]; - [childController release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/VoicesViewController.h --- a/cocoaTouch/VoicesViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// VoicesViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface VoicesViewController : UITableViewController { - NSMutableDictionary *teamDictionary; - - NSArray *voiceArray; - NSIndexPath *lastIndexPath; - - int voiceBeingPlayed; -} - -@property (nonatomic,retain) NSMutableDictionary *teamDictionary; -@property (nonatomic,retain) NSArray *voiceArray; -@property (nonatomic,retain) NSIndexPath *lastIndexPath; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/VoicesViewController.m --- a/cocoaTouch/VoicesViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -// -// VoicesViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 02/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "VoicesViewController.h" -#import "CommodityFunctions.h" -#import "openalbridge.h" - - -@implementation VoicesViewController -@synthesize teamDictionary, voiceArray, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle -- (void)viewDidLoad { - [super viewDidLoad]; - srandom(time(NULL)); - - openal_init(20); -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - // this moves the tableview to the top - [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; - voiceBeingPlayed = -1; - - // load all the voices names and store them into voiceArray - NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL]; - self.voiceArray = array; -} - -/* -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; -} -*/ - -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - if(voiceBeingPlayed >= 0) { - openal_stopsound(voiceBeingPlayed); - voiceBeingPlayed = -1; - } -} - - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.voiceArray count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - NSString *voice = [[voiceArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; - cell.textLabel.text = voice; - - if ([voice isEqualToString:[teamDictionary objectForKey:@"voicepack"]]) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - self.lastIndexPath = indexPath; - } else { - cell.accessoryType = UITableViewCellAccessoryNone; - } - - return cell; -} - - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - - if (newRow != oldRow) { - [teamDictionary setObject:[voiceArray objectAtIndex:newRow] forKey:@"voicepack"]; - - // tell our boss to write this new stuff on disk - [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; - [self.tableView reloadData]; - - self.lastIndexPath = indexPath; - [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - } - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - - if (voiceBeingPlayed >= 0) { - openal_stopsound(voiceBeingPlayed); - voiceBeingPlayed = -1; - } - - // the keyword static prevents re-initialization of the variable - NSString *voiceDir = [[NSString alloc] initWithFormat:@"%@/%@/",VOICES_DIRECTORY(),[voiceArray objectAtIndex:newRow]]; - NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:voiceDir error:NULL]; - - int index = random() % [array count]; - - voiceBeingPlayed = openal_loadfile([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]); - [voiceDir release]; - openal_playsound(voiceBeingPlayed); -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - // Relinquish ownership any cached data, images, etc that aren't in use. -} - --(void) viewDidUnload { - openal_close(); - voiceBeingPlayed = -1; - self.lastIndexPath = nil; - self.teamDictionary = nil; - self.voiceArray = nil; - [super viewDidUnload]; - MSG_DIDUNLOAD(); -} - --(void) dealloc { - [voiceArray release]; - [teamDictionary release]; - [lastIndexPath release]; - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/WeaponSettingsViewController.h --- a/cocoaTouch/WeaponSettingsViewController.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -// -// WeaponSettingsViewController.h -// HedgewarsMobile -// -// Created by Vittorio on 19/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface WeaponSettingsViewController : UITableViewController { - -} - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/WeaponSettingsViewController.m --- a/cocoaTouch/WeaponSettingsViewController.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -// -// WeaponSettingsViewController.m -// HedgewarsMobile -// -// Created by Vittorio on 19/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "WeaponSettingsViewController.h" - - -@implementation WeaponSettingsViewController - - -#pragma mark - -#pragma mark Initialization - -/* -- (id)initWithStyle:(UITableViewStyle)style { - // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - if ((self = [super initWithStyle:style])) { - } - return self; -} -*/ - - -#pragma mark - -#pragma mark View lifecycle - -/* -- (void)viewDidLoad { - [super viewDidLoad]; - - // Uncomment the following line to preserve selection between presentations. - self.clearsSelectionOnViewWillAppear = NO; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; -} -*/ - -/* -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; -} -*/ -/* -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; -} -*/ -/* -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; -} -*/ -/* -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; -} -*/ - - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // Override to allow orientations other than the default portrait orientation. - return YES; -} - - -#pragma mark - -#pragma mark Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - // Return the number of sections. - return 1; -} - - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - // Return the number of rows in the section. - return 1; -} - - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - } - - // Configure the cell... - - return cell; -} - - -/* -// Override to support conditional editing of the table view. -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the specified item to be editable. - return YES; -} -*/ - - -/* -// Override to support editing the table view. -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; - } - else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } -} -*/ - - -/* -// Override to support rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { -} -*/ - - -/* -// Override to support conditional rearranging of the table view. -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the item to be re-orderable. - return YES; -} -*/ - - -#pragma mark - -#pragma mark Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - // Navigation logic may go here. Create and push another view controller. - /* - <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; - // ... - // Pass the selected object to the new view controller. - [self.navigationController pushViewController:detailViewController animated:YES]; - [detailViewController release]; - */ -} - - -#pragma mark - -#pragma mark Memory management - -- (void)didReceiveMemoryWarning { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Relinquish ownership any cached data, images, etc that aren't in use. -} - -- (void)viewDidUnload { - // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. - // For example: self.myOutlet = nil; -} - - -- (void)dealloc { - [super dealloc]; -} - - -@end - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/CGPointUtils.c --- a/cocoaTouch/otherSrc/CGPointUtils.c Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * CGPointUtils.c - * PinchMe - * - * Created by Jeff LaMarche on 8/2/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. - * - */ - -#include "CGPointUtils.h" -#include - - -CGFloat distanceBetweenPoints (CGPoint first, CGPoint second) { - CGFloat deltaX = second.x - first.x; - CGFloat deltaY = second.y - first.y; - return sqrt(deltaX*deltaX + deltaY*deltaY ); -} - -CGFloat angleBetweenPoints(CGPoint first, CGPoint second) { - CGFloat height = second.y - first.y; - CGFloat width = first.x - second.x; - CGFloat rads = atan(height/width); - return radiansToDegrees(rads); -} - -CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End) { - CGFloat a = line1End.x - line1Start.x; - CGFloat b = line1End.y - line1Start.y; - CGFloat c = line2End.x - line2Start.x; - CGFloat d = line2End.y - line2Start.y; - CGFloat rads = acos(((a*c) + (b*d)) / ((sqrt(a*a + b*b)) * (sqrt(c*c + d*d)))); - return radiansToDegrees(rads); -} diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/CGPointUtils.h --- a/cocoaTouch/otherSrc/CGPointUtils.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -/* - * CGPointUtils.h - * PinchMe - * - * Created by Jeff LaMarche on 8/2/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. - * - */ - -#import - -#define degreesToRadian(x) (M_PI * x / 180.0) -#define radiansToDegrees(x) (180.0 * x / M_PI) - -CGFloat distanceBetweenPoints (CGPoint first, CGPoint second); -CGFloat angleBetweenPoints(CGPoint first, CGPoint second); -CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint lin2End); diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/CommodityFunctions.h --- a/cocoaTouch/otherSrc/CommodityFunctions.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -// -// CommodityFunctions.h -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -#define MAX_HOGS 8 - - -#define SETTINGS_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ - objectAtIndex:0] stringByAppendingString:@"/settings.plist"] -#define GAMECONFIG_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ - objectAtIndex:0] stringByAppendingString:@"/gameconfig.plist"] -#define DEBUG_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ - objectAtIndex:0] stringByAppendingString:@"/debug.txt"] - -#define TEAMS_DIRECTORY() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ - objectAtIndex:0] stringByAppendingString:@"/Teams/"] -#define SCHEMES_DIRECTORY() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ - objectAtIndex:0] stringByAppendingString:@"/Schemes/"] - -#define GRAPHICS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/"] -#define HATS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"] -#define GRAVES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Graves/"] -#define BOTLEVELS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hedgehog/botlevels"] -#define BTN_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Btn"] -#define FLAGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Flags/"] -#define FORTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Forts/"] -#define THEMES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Themes/"] -#define MAPS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"] -#define VOICES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"] - -#define MSG_MEMCLEAN() DLog(@"has cleaned up some memory"); print_free_memory() -#define MSG_DIDUNLOAD() DLog(@"did unload"); - -void createTeamNamed (NSString *nameWithoutExt); -void createSchemeNamed (NSString *nameWithoutExt); -BOOL rotationManager (UIInterfaceOrientation interfaceOrientation); -NSInteger randomPort (); -void popError (const char *title, const char *message); -void print_free_memory (); - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/CommodityFunctions.m --- a/cocoaTouch/otherSrc/CommodityFunctions.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -// -// CommodityFunctions.m -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "CommodityFunctions.h" -#import -#import - -void createTeamNamed (NSString *nameWithoutExt) { - NSString *teamsDirectory = TEAMS_DIRECTORY(); - - if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { - [[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory - withIntermediateDirectories:NO - attributes:nil - error:NULL]; - } - - NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: MAX_HOGS]; - - for (int i = 0; i < MAX_HOGS; i++) { - NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; - NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:0],@"level", - hogName,@"hogname", @"NoHat",@"hat", nil]; - [hogName release]; - [hedgehogs addObject:hog]; - [hog release]; - } - - NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"0",@"hash", nameWithoutExt,@"teamname", - @"Statue",@"grave", @"Plane",@"fort", @"Default",@"voicepack", - @"hedgewars",@"flag", hedgehogs,@"hedgehogs", nil]; - [hedgehogs release]; - - NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt]; - - [theTeam writeToFile:teamFile atomically:YES]; - [teamFile release]; - [theTeam release]; -} - -void createSchemeNamed (NSString *nameWithoutExt) { - NSString *schemesDirectory = SCHEMES_DIRECTORY(); - - if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { - [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory - withIntermediateDirectories:NO - attributes:nil - error:NULL]; - } - - NSArray *theScheme = [[NSArray alloc] initWithObjects: - [NSNumber numberWithBool:NO], //fortmode - [NSNumber numberWithBool:NO], //divideteam - [NSNumber numberWithBool:NO], //solidland - [NSNumber numberWithBool:NO], //addborder - [NSNumber numberWithBool:NO], //lowgravity - [NSNumber numberWithBool:NO], //lasersight - [NSNumber numberWithBool:NO], //invulnerable - [NSNumber numberWithBool:NO], //addmines - [NSNumber numberWithBool:NO], //vampirism - [NSNumber numberWithBool:NO], //karma - [NSNumber numberWithBool:NO], //artillery - [NSNumber numberWithBool:YES], //randomorder - [NSNumber numberWithBool:NO], //king - [NSNumber numberWithBool:NO], //placehedgehogs - [NSNumber numberWithBool:NO], //clansharesammo - [NSNumber numberWithBool:NO], //disablegirders - [NSNumber numberWithBool:NO], //disablelandobjects - [NSNumber numberWithInt:100], //damagemodifier - [NSNumber numberWithInt:45], //turntime - [NSNumber numberWithInt:100], //initialhealth - [NSNumber numberWithInt:15], //suddendeathtimeout - [NSNumber numberWithInt:5], //cratedrops - [NSNumber numberWithInt:3], //minestime - [NSNumber numberWithInt:4], //mines - [NSNumber numberWithInt:0], //dudmines - [NSNumber numberWithInt:2], //explosives - nil]; - - NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; - - [theScheme writeToFile:schemeFile atomically:YES]; - [schemeFile release]; - [theScheme release]; -} - -BOOL rotationManager (UIInterfaceOrientation interfaceOrientation) { - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - return YES; - else - return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || - (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); -} - -NSInteger randomPort () { - srandom(time(NULL)); - return (random() % 64511) + 1024; -} - -void popError (const char *title, const char *message) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:title] - message:[NSString stringWithUTF8String:message] - delegate:nil - cancelButtonTitle:@"Ok" - otherButtonTitles:nil]; - [alert show]; - [alert release]; -} - -// by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html -void print_free_memory () { - mach_port_t host_port; - mach_msg_type_number_t host_size; - vm_size_t pagesize; - - host_port = mach_host_self(); - host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); - host_page_size(host_port, &pagesize); - - vm_statistics_data_t vm_stat; - - if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) - DLog(@"Failed to fetch vm statistics"); - - /* Stats in bytes */ - natural_t mem_used = (vm_stat.active_count + - vm_stat.inactive_count + - vm_stat.wire_count) * pagesize; - natural_t mem_free = vm_stat.free_count * pagesize; - natural_t mem_total = mem_used + mem_free; - DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total); -} diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/HogButtonView.h --- a/cocoaTouch/otherSrc/HogButtonView.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// HogButtonView.h -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface HogButtonView : UIButton { - NSInteger numberOfHogs; - UIImage *singleHog; - NSMutableDictionary *ownerDictionary; -} - -@property (nonatomic,retain) UIImage *singleHog; -@property (nonatomic) NSInteger numberOfHogs; -@property (nonatomic,retain) NSMutableDictionary *ownerDictionary; - --(void) drawManyHogs:(NSInteger) hogs; --(void) addOne; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/HogButtonView.m --- a/cocoaTouch/otherSrc/HogButtonView.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -// -// HogButtonView.m -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "HogButtonView.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation HogButtonView -@synthesize singleHog, numberOfHogs, ownerDictionary; - --(id) initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { - self.backgroundColor = [UIColor clearColor]; - - NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; - UIImage *normalHogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; - [normalHogFile release]; - - self.singleHog = normalHogSprite; - [normalHogSprite release]; - [self addTarget:self action:@selector(addOne) forControlEvents:UIControlEventTouchUpInside]; - } - return self; -} - --(void) addOne { - self.highlighted = NO; - NSInteger number = self.numberOfHogs; - number++; - [self drawManyHogs:number]; -} - --(void) drawManyHogs:(NSInteger) hogs { - if (numberOfHogs != hogs) { - if (hogs <= MAX_HOGS && hogs >= 1) - numberOfHogs = hogs; - else { - if (hogs > MAX_HOGS) - numberOfHogs = 1; - else - numberOfHogs = MAX_HOGS; - } - [ownerDictionary setObject:[NSNumber numberWithInt:numberOfHogs] forKey:@"number"]; - - UIImage *teamHogs = [[[UIImage alloc] init] autorelease]; - for (int i = 0; i < numberOfHogs; i++) { - teamHogs = [singleHog mergeWith:teamHogs - atPoint:CGPointMake(8, 0) - atSize:CGSizeMake(88, 32)]; - } - [self setImage:teamHogs forState:UIControlStateNormal]; - } -} - --(void) dealloc { - [ownerDictionary release]; - [singleHog release]; - [super dealloc]; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/PascalImports.h --- a/cocoaTouch/otherSrc/PascalImports.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * PascalImports.h -// fpciphonedel -// -// Created by Vittorio on 07/01/10. -// Copyright __MyCompanyName__ 2010. All rights reserved. - * - */ - -#ifndef PASCALIMPORTS -#define PASCALIMPORTS - -#ifdef __cplusplus -extern "C" { -#endif - - /* add C declarations below for all exported Pascal functions/procedure - * that you want to use - */ - - void Game(const char *args[]); - void GenLandPreview(); - - - void HW_versionInfo(short int*, char**); - - void HW_click(void); - void HW_zoomIn(void); - void HW_zoomOut(void); - void HW_zoomReset(void); - void HW_ammoMenu(void); - - void HW_allKeysUp(void); - - void HW_walkLeft(void); - void HW_walkRight(void); - void HW_aimUp(void); - void HW_aimDown(void); - void HW_shoot(void); - void HW_jump(void); - void HW_backjump(void); - - void HW_chat(void); - void HW_tab(void); - void HW_pause(void); - - void HW_cursorUp(int); - void HW_cursorDown(int); - void HW_cursorLeft(int); - void HW_cursorRight(int); - - void HW_terminate(BOOL); - - void HW_setLandscape(BOOL); -#ifdef __cplusplus -} -#endif - -#endif diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/SquareButtonView.h --- a/cocoaTouch/otherSrc/SquareButtonView.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// -// HogButtonView.h -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface SquareButtonView : UIButton { - NSInteger colorIndex; - NSUInteger selectedColor; - NSArray *colorArray; - NSMutableDictionary *ownerDictionary; -} - -@property (nonatomic,retain) NSArray *colorArray; -@property (nonatomic) NSUInteger selectedColor; -@property (nonatomic,retain) NSMutableDictionary *ownerDictionary; - --(void) nextColor; --(void) selectColor:(NSUInteger) color; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/SquareButtonView.m --- a/cocoaTouch/otherSrc/SquareButtonView.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -// -// HogButtonView.m -// HedgewarsMobile -// -// Created by Vittorio on 20/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "SquareButtonView.h" -#import -#import "CommodityFunctions.h" -#import "UIImageExtra.h" - -@implementation SquareButtonView -@synthesize colorArray, selectedColor, ownerDictionary; - --(id) initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { - colorIndex = -1; - selectedColor = 0; - - // list of allowed colors - NSArray *colors = [[NSArray alloc] initWithObjects: [NSNumber numberWithUnsignedInt:4421353], // bluette - [NSNumber numberWithUnsignedInt:4100897], // greeeen - [NSNumber numberWithUnsignedInt:10632635], // violett - [NSNumber numberWithUnsignedInt:16749353], // oranngy - [NSNumber numberWithUnsignedInt:14483456], // reddish - [NSNumber numberWithUnsignedInt:7566195], // graaaay - nil]; - self.colorArray = colors; - [colors release]; - - // set the color to the first available one - [self nextColor]; - - // this makes the button round and nice - [self.layer setCornerRadius:7.0f]; - [self.layer setMasksToBounds:YES]; - - // this changes the color at button press - [self addTarget:self action:@selector(nextColor) forControlEvents:UIControlEventTouchUpInside]; - - self.backgroundColor = [UIColor blackColor]; - } - return self; -} - --(void) nextColor { - colorIndex++; - if (colorIndex >= [colorArray count]) - colorIndex = 0; - - NSUInteger color = [[self.colorArray objectAtIndex:colorIndex] unsignedIntValue]; - [self selectColor:color]; - - [ownerDictionary setObject:[NSNumber numberWithInt:color] forKey:@"color"]; -} - --(void) selectColor:(NSUInteger) color { - if (color != selectedColor) { - selectedColor = color; - - UIGraphicsBeginImageContext(self.frame.size); - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSetRGBFillColor(context, ((color & 0x00FF0000) >> 16)/255.0f, - ((color & 0x0000FF00) >> 8)/255.0f, - (color & 0x000000FF)/255.0f, - 1.0f); - CGContextFillRect(context, CGRectMake(1.1, 1.1, self.frame.size.width-2.2, self.frame.size.height-2.2)); - - UIImageView *resultingImage = [[UIImageView alloc] initWithImage: UIGraphicsGetImageFromCurrentImageContext()]; - UIGraphicsEndImageContext(); - - [self setImage:resultingImage.image forState:UIControlStateNormal]; - [resultingImage release]; - - } - /* - self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f - green:((color & 0x0000FF00) >> 8)/255.0f - blue: (color & 0x000000FF)/255.0f - alpha:1.0f]; - */ -} - --(void) dealloc { - [ownerDictionary release]; - [colorArray release]; - [super dealloc]; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/UIImageExtra.h --- a/cocoaTouch/otherSrc/UIImageExtra.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -// -// UIImageExtra.h -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface UIImage (extra) - --(UIImage *)scaleToSize:(CGSize) size; --(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint; --(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize; --(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect; --(UIImage *)convertToGrayScale; --(UIImage *)maskImageWith:(UIImage *)maskImage; --(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh; - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/otherSrc/UIImageExtra.m --- a/cocoaTouch/otherSrc/UIImageExtra.m Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -// -// UIImageExtra.m -// HedgewarsMobile -// -// Created by Vittorio on 08/04/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "UIImageExtra.h" - - -@implementation UIImage (extra) - --(UIImage *)scaleToSize:(CGSize) size { - // Create a bitmap graphics context - // This will also set it as the current context - UIGraphicsBeginImageContext(size); - - // Draw the scaled image in the current context - [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; - - // Create a new image from current context - UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); - - // Pop the current context from the stack - UIGraphicsEndImageContext(); - - // Return our new scaled image (autoreleased) - return scaledImage; -} - --(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint { - // create a contex of size of the background image - return [self mergeWith:secondImage atPoint:secondImagePoint atSize:self.size]; -} - --(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize { - UIGraphicsBeginImageContext(resultingSize); - - // drav the background image - [self drawAtPoint:CGPointMake(0,0)]; - - // draw the image on top of the first image - [secondImage drawAtPoint:secondImagePoint]; - - // create an image from the current contex (not thread safe) - UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); - - // free drawing contex - UIGraphicsEndImageContext(); - - // return the resulting autoreleased image - return resultImage; -} - --(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect { - // load image from path - UIImage *image = [[UIImage alloc] initWithContentsOfFile: path]; - - if (nil != image) { - // get its CGImage representation with a give size - CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], rect); - - // clean memory - [image release]; - - // create a UIImage from the CGImage (memory must be allocated already) - UIImage *sprite = [self initWithCGImage:cgImgage]; - - // clean memory - CGImageRelease(cgImgage); - - // return resulting image - return sprite; - } else { - NSLog(@"initWithContentsOfFile: andCutAt: FAILED"); - return nil; - } -} - --(UIImage *)convertToGrayScale { - // Create image rectangle with current image width/height - CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height); - - // Grayscale color space - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); - - // Create bitmap content with current image size and grayscale colorspace - CGContextRef context = CGBitmapContextCreate(nil, self.size.width, self.size.height, 8, 0, colorSpace, kCGImageAlphaNone); - - // Draw image into current context, with specified rectangle - // using previously defined context (with grayscale colorspace) - CGContextDrawImage(context, imageRect, [self CGImage]); - - // Create bitmap image info from pixel data in current context - CGImageRef imageRef = CGBitmapContextCreateImage(context); - - // Create a new UIImage object - UIImage *newImage = [UIImage imageWithCGImage:imageRef]; - - // Release colorspace, context and bitmap information - CGColorSpaceRelease(colorSpace); - CGContextRelease(context); - CFRelease(imageRef); - - // Return the new grayscale image - return newImage; -} - -// by http://iphonedevelopertips.com/cocoa/how-to-mask-an-image.html turned into a category by koda --(UIImage*) maskImageWith:(UIImage *)maskImage { - CGImageRef maskRef = maskImage.CGImage; - - CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef), - CGImageGetHeight(maskRef), - CGImageGetBitsPerComponent(maskRef), - CGImageGetBitsPerPixel(maskRef), - CGImageGetBytesPerRow(maskRef), - CGImageGetDataProvider(maskRef), NULL, false); - - CGImageRef masked = CGImageCreateWithMask([self CGImage], mask); - - CGImageRelease(mask); - - UIImage* retImage = [UIImage imageWithCGImage:masked]; - - CGImageRelease(masked); - - return retImage; -} - -// by http://blog.sallarp.com/iphone-uiimage-round-corners/ turned into a category by koda -void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) -{ - float fw, fh; - if (ovalWidth == 0 || ovalHeight == 0) { - CGContextAddRect(context, rect); - return; - } - CGContextSaveGState(context); - CGContextTranslateCTM (context, CGRectGetMinX(rect), CGRectGetMinY(rect)); - CGContextScaleCTM (context, ovalWidth, ovalHeight); - fw = CGRectGetWidth (rect) / ovalWidth; - fh = CGRectGetHeight (rect) / ovalHeight; - CGContextMoveToPoint(context, fw, fh/2); - CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); - CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); - CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); - CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); - CGContextClosePath(context); - CGContextRestoreGState(context); -} - --(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh { - UIImage * newImage = nil; - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - NSInteger cornerWidth = sizewh.width; - NSInteger cornerHeight = sizewh.height; - int w = self.size.width; - int h = self.size.height; - - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); - - CGContextBeginPath(context); - CGRect rect = CGRectMake(0, 0, w, h); - addRoundedRectToPath(context, rect, cornerWidth, cornerHeight); - CGContextClosePath(context); - CGContextClip(context); - - CGContextDrawImage(context, CGRectMake(0, 0, w, h), self.CGImage); - - CGImageRef imageMasked = CGBitmapContextCreateImage(context); - CGContextRelease(context); - CGColorSpaceRelease(colorSpace); - [self release]; - - newImage = [[UIImage imageWithCGImage:imageMasked] retain]; - CGImageRelease(imageMasked); - - [pool release]; - - return newImage; -} - - -@end diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/Default-Landscape.png Binary file cocoaTouch/resources/Default-Landscape.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/Default.png Binary file cocoaTouch/resources/Default.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/Icon-iPad.png Binary file cocoaTouch/resources/Icon-iPad.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/Icon.png Binary file cocoaTouch/resources/Icon.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/arrowDown.png Binary file cocoaTouch/resources/arrowDown.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/arrowLeft.png Binary file cocoaTouch/resources/arrowLeft.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/arrowRight.png Binary file cocoaTouch/resources/arrowRight.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/arrowUp.png Binary file cocoaTouch/resources/arrowUp.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/backgroundBottom.png Binary file cocoaTouch/resources/backgroundBottom.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/backgroundCenter.png Binary file cocoaTouch/resources/backgroundCenter.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/backgroundLeft.png Binary file cocoaTouch/resources/backgroundLeft.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/backgroundRight.png Binary file cocoaTouch/resources/backgroundRight.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/backgroundTop.png Binary file cocoaTouch/resources/backgroundTop.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/borderBottom.png Binary file cocoaTouch/resources/borderBottom.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/borderTop.png Binary file cocoaTouch/resources/borderTop.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/joyPush.png Binary file cocoaTouch/resources/joyPush.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/menuCorner.png Binary file cocoaTouch/resources/menuCorner.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/networkButton.png Binary file cocoaTouch/resources/networkButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/playButton.png Binary file cocoaTouch/resources/playButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/settingsButton.png Binary file cocoaTouch/resources/settingsButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/storeButton.png Binary file cocoaTouch/resources/storeButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/resources/title.png Binary file cocoaTouch/resources/title.png has changed diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/GameConfigViewController-iPad.xib --- a/cocoaTouch/xib/GameConfigViewController-iPad.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,489 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 266 - {{0, 724}, {1024, 44}} - - NO - NO - IBIPadFramework - - YES - - Back - IBIPadFramework - 1 - - - - IBIPadFramework - - 5 - - - 1 - Start Game - IBIPadFramework - 90 - 2 - - - - - - {1024, 768} - - 3 - MQA - - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 17 - - - - buttonPressed: - - - - 23 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 15 - - - YES - - - - - - - - 16 - - - - - 18 - - - - - 22 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 15.IBPluginDependency - 16.IBPluginDependency - 18.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 22.IBPluginDependency - - - YES - GameConfigViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{285, -28}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 29 - - - - YES - - GameConfigViewController - UIViewController - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - id - id - - - - IBProjectSource - ../../cocoaTouch/GameConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj - 3 - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/GameConfigViewController-iPhone.xib --- a/cocoaTouch/xib/GameConfigViewController-iPhone.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,640 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 266 - - YES - - - 292 - {{97, 8}, {245, 30}} - - NO - IBCocoaTouchFramework - 2 - 3 - 0 - - YES - Map - Teams - Details - - - YES - - - - - - YES - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - {{0, 276}, {480, 44}} - - NO - NO - IBCocoaTouchFramework - - YES - - Back - IBCocoaTouchFramework - 1 - - - - IBCocoaTouchFramework - - 5 - - - IBCocoaTouchFramework - - - - - IBCocoaTouchFramework - - 5 - - - 1 - Start Game - IBCocoaTouchFramework - 90 - 2 - - - - - - {480, 320} - - - 3 - MQA - - NO - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 17 - - - - buttonPressed: - - - - 23 - - - - segmentPressed: - - - 13 - - 29 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 15 - - - YES - - - - - - - - - - 16 - - - - - 18 - - - - - 19 - - - - - 21 - - - YES - - - - - - 20 - - - - - 22 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 15.IBPluginDependency - 16.IBPluginDependency - 18.IBPluginDependency - 19.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 20.IBPluginDependency - 22.IBPluginDependency - - - YES - GameConfigViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{639, 516}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 29 - - - - YES - - GameConfigViewController - UIViewController - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - id - id - - - - YES - - YES - availableTeamsTableView - mapButton - randomButton - schemesButton - startButton - weaponsButton - - - YES - UITableView - UIButton - UIButton - UIButton - UIBarButtonItem - UIButton - - - - IBProjectSource - ../../cocoaTouch/GameConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj - 3 - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/MainMenuViewController-iPad.xib --- a/cocoaTouch/xib/MainMenuViewController-iPad.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,689 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 274 - {1024, 768} - - NO - IBIPadFramework - - NSImage - Background.png - - - - - 292 - {{147, 20}, {745, 146}} - - NO - 4 - NO - IBIPadFramework - - NSImage - HedgewarsTitle.png - - - - - 292 - {{147, 200}, {258, 215}} - - NO - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - NSImage - Multiplayer.png - - - - - 292 - {{634, 493}, {258, 215}} - - NO - 1 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - NetworkPlay.png - - - - - 292 - {{175, 600}, {18, 19}} - - NO - 3 - IBIPadFramework - 0 - 0 - - 3 - YES - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - 292 - {{762, 183}, {87, 21}} - - NO - YES - 7 - NO - IBIPadFramework - - - Helvetica-Oblique - 17 - 16 - - - 1 - MSAxIDEAA - - 1 - - - - 1 - 10 - - - - 292 - {{267, 579}, {72, 62}} - - NO - 2 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - settingsButton.png - - - - {1024, 768} - - 1 - MCAwIDAAA - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - switchViews: - - - 7 - - 47 - - - - switchViews: - - - 7 - - 48 - - - - switchViews: - - - 7 - - 49 - - - - versionLabel - - - - 51 - - - - switchViews: - - - 7 - - 54 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 38 - - - - - 39 - - - local - - - 40 - - - multi - - - 45 - - - - - 50 - - - - - 52 - - - - - 37 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 37.IBPluginDependency - 38.IBPluginDependency - 39.IBPluginDependency - 40.IBPluginDependency - 45.IBPluginDependency - 50.IBPluginDependency - 52.IBPluginDependency - - - YES - MainMenuViewController - UIResponder - {{224, 119}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 86 - - - - YES - - MainMenuViewController - UIViewController - - switchViews: - id - - - YES - - YES - settingsSplitViewController - versionLabel - - - YES - UISplitViewController - UILabel - - - - IBProjectSource - ../../cocoaTouch/MainMenuViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISplitViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj - 3 - - YES - - YES - Background.png - HedgewarsTitle.png - Multiplayer.png - NetworkPlay.png - settingsButton.png - - - YES - {1024, 768} - {720, 140} - {264, 219} - {314, 260} - {57, 51} - - - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/MainMenuViewController-iPhone.xib --- a/cocoaTouch/xib/MainMenuViewController-iPhone.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,785 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 293 - - YES - - - 274 - {{0, 21}, {480, 278}} - - - 3 - MCAwAA - - 4 - NO - IBCocoaTouchFramework - - NSImage - backgroundCenter.png - - - - - 293 - {{121, 25}, {240, 52}} - - NO - NO - 4 - NO - IBCocoaTouchFramework - - NSImage - title.png - - - - - 289 - {{240, 102}, {220, 52}} - - - 1 - MCAwIDAgMAA - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - playButton.png - - - - - 265 - {{240, 177}, {220, 52}} - - - 1 - MCAwIDAgMAA - - NO - NO - 3 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - networkButton.png - - - - - 260 - {{12, 144}, {220, 52}} - - - 1 - MCAwIDAgMAA - - NO - NO - 3 - IBCocoaTouchFramework - 0 - 0 - - - - 3 - MAA - - - - NSImage - storeButton.png - - - - - 292 - {{60, 102}, {145, 21}} - - NO - YES - NO - IBCocoaTouchFramework - - - Helvetica-Oblique - 17 - 16 - - - 1 - MSAxIDEAA - - - 1 - 10 - 1 - - - - 269 - {{209, 237}, {59, 52}} - - NO - NO - 2 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - settingsButton.png - - - - - 290 - {480, 17} - - NO - NO - 4 - NO - IBCocoaTouchFramework - - NSImage - borderTop.png - - - - - 266 - {{0, 297}, {480, 23}} - - NO - NO - 4 - NO - IBCocoaTouchFramework - - NSImage - borderBottom.png - - - - - 292 - {{20, 270}, {18, 19}} - - NO - 3 - IBCocoaTouchFramework - 0 - 0 - - 3 - YES - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - {480, 320} - - - 1 - MCAwIDAAA - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - switchViews: - - - 7 - - 30 - - - - versionLabel - - - - 37 - - - - switchViews: - - - 7 - - 38 - - - - switchViews: - - - 7 - - 39 - - - - switchViews: - - - 7 - - 40 - - - - switchViews: - - - 7 - - 42 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 35 - - - - - 22 - - - - - 23 - - - - - 24 - - - - - 25 - - - - - 26 - - - - - 27 - - - - - 28 - - - - - 36 - - - - - 41 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 22.IBPluginDependency - 23.IBPluginDependency - 24.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 27.IBPluginDependency - 28.IBPluginDependency - 35.IBPluginDependency - 36.IBPluginDependency - 41.IBPluginDependency - - - YES - MainMenuViewController - UIResponder - {{432, 461}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 42 - - - - YES - - MainMenuViewController - UIViewController - - switchViews: - id - - - versionLabel - UILabel - - - IBProjectSource - ../../cocoaTouch/MainMenuViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj - 3 - - YES - - YES - backgroundCenter.png - borderBottom.png - borderTop.png - networkButton.png - playButton.png - settingsButton.png - storeButton.png - title.png - - - YES - {480, 278} - {480, 21} - {480, 21} - {217, 51} - {216, 51} - {57, 51} - {216, 51} - {262, 84} - - - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/MapConfigViewController-iPad.xib --- a/cocoaTouch/xib/MapConfigViewController-iPad.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,787 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - - YES - - - 289 - {{756, 170}, {240, 30}} - - NO - IBIPadFramework - 2 - 3 - 0 - - YES - Random - Map - Maze - - - YES - - - - - - YES - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - - 292 - {{570, 117}, {149, 23}} - - NO - IBIPadFramework - 0 - 0 - 0.05000000074505806 - 0.05000000074505806 - - - - 289 - {{746, 20}, {256, 128}} - - NO - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 4 - 4 - 4 - 4 - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - - - 292 - {{623, 20}, {42, 21}} - - NO - YES - 7 - NO - IBIPadFramework - ... - - 1 - MCAwIDAAA - - - 1 - 10 - 1 - - - - 292 - {{572, 66}, {145, 29}} - - NO - YES - 7 - NO - IBIPadFramework - Label - - Helvetica - 24 - 16 - - - - 1 - 10 - 1 - - - - 265 - {{724, 224}, {300, 500}} - - - 3 - MSAwAA - - YES - IBIPadFramework - NO - 1 - 0 - YES - 44 - 22 - 22 - - - - -2147483356 - {{0, 224}, {300, 500}} - - NO - IBIPadFramework - 0 - 0 - - 1 - teams section - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - {1024, 724} - - - 2 - MC44MzkyMTU3NTU1IDAuODQ3MDU4ODkyMyAwLjg3MDU4ODMwMjYAA - - - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - updatePreview - - - 7 - - 12 - - - - previewButton - - - - 13 - - - - maxLabel - - - - 16 - - - - sizeLabel - - - - 18 - - - - sliderChanged: - - - 13 - - 19 - - - - sliderEndedChanging: - - - 7 - - 20 - - - - segmentedControl - - - - 21 - - - - segmentedControlChanged: - - - 13 - - 22 - - - - slider - - - - 23 - - - - dataSource - - - - 26 - - - - delegate - - - - 27 - - - - tableView - - - - 32 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 7 - - - - - 8 - - - - - 11 - - - - - 17 - - - - - 25 - - - Table View (Themes) - - - 39 - - - - - 9 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 11.IBPluginDependency - 17.IBPluginDependency - 25.IBPluginDependency - 39.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - MapConfigViewController - UIResponder - {{255, 115}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 49 - - - - YES - - MapConfigViewController - UIViewController - - YES - - YES - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - updatePreview - - - YES - id - id - id - id - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - UILabel - UIButton - UISegmentedControl - UILabel - UISlider - UITableView - - - - IBProjectSource - ../../cocoaTouch/MapConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UISlider - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISlider.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj - 3 - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/MapConfigViewController-iPhone.xib --- a/cocoaTouch/xib/MapConfigViewController-iPhone.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,750 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 292 - {{28, 166}, {240, 30}} - - NO - IBCocoaTouchFramework - 2 - 3 - 0 - - YES - Random - Map - Maze - - - YES - - - - - - YES - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - - 292 - {{121, 209}, {149, 23}} - - NO - IBCocoaTouchFramework - 0 - 0 - 0.05000000074505806 - 0.05000000074505806 - - - - 292 - {{20, 20}, {256, 128}} - - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - - - 292 - {{54, 234}, {42, 21}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - ... - - 1 - MCAwIDAAA - - - 1 - 10 - 1 - - - - 292 - {{123, 239}, {145, 29}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Label - - Helvetica - 24 - 16 - - - - 1 - 10 - 1 - - - - 274 - {{295, 0}, {185, 276}} - - - YES - IBCocoaTouchFramework - NO - 1 - 0 - YES - 44 - 22 - 22 - - - {480, 276} - - - - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - updatePreview - - - 7 - - 12 - - - - previewButton - - - - 13 - - - - maxLabel - - - - 16 - - - - sizeLabel - - - - 18 - - - - sliderChanged: - - - 13 - - 19 - - - - sliderEndedChanging: - - - 7 - - 20 - - - - segmentedControl - - - - 21 - - - - segmentedControlChanged: - - - 13 - - 22 - - - - slider - - - - 23 - - - - dataSource - - - - 26 - - - - delegate - - - - 27 - - - - tableView - - - - 32 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 11 - - - - - 17 - - - - - 25 - - - Table View (Themes) - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 11.IBPluginDependency - 17.IBPluginDependency - 25.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - MapConfigViewController - UIResponder - {{744, 568}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 32 - - - - YES - - MapConfigViewController - UIViewController - - YES - - YES - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - updatePreview - - - YES - id - id - id - id - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - UILabel - UIButton - UISegmentedControl - UILabel - UISlider - UITableView - - - - IBProjectSource - ../../cocoaTouch/MapConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UISlider - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISlider.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj - 3 - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/OverlayViewController-iPad.xib --- a/cocoaTouch/xib/OverlayViewController-iPad.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,945 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{0, 675}, {39, 53}} - - NO - NO - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - arrowLeft.png - - - - - 292 - {{90, 675}, {39, 54}} - - NO - NO - 1 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowRight.png - - - - - 292 - {{964, 690}, {64, 48}} - - NO - NO - 6 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyPush.png - - - - - 292 - {{919, 665}, {64, 50}} - - NO - NO - 5 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - - 292 - {{908, 723}, {61, 45}} - - NO - NO - 4 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - - 292 - {{37, 638}, {53, 39}} - - NO - NO - 2 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowUp.png - - - - - 292 - {{37, 729}, {53, 39}} - - NO - NO - 3 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowDown.png - - - - - 292 - {{956, -5}, {72, 64}} - - NO - 10 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - menuCorner.png - - - - {1024, 768} - - - 3 - MSAwAA - - NO - YES - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - 1 - - 8 - - - - buttonReleased: - - - 9 - - 9 - - - - buttonReleased: - - - 7 - - 10 - - - - buttonReleased: - - - 8 - - 11 - - - - buttonReleased: - - - 8 - - 13 - - - - buttonReleased: - - - 9 - - 14 - - - - buttonPressed: - - - 1 - - 15 - - - - buttonReleased: - - - 7 - - 16 - - - - buttonReleased: - - - 9 - - 18 - - - - buttonPressed: - - - 1 - - 19 - - - - buttonReleased: - - - 8 - - 20 - - - - buttonReleased: - - - 7 - - 21 - - - - buttonReleased: - - - 8 - - 23 - - - - buttonReleased: - - - 9 - - 24 - - - - buttonPressed: - - - 1 - - 25 - - - - buttonReleased: - - - 7 - - 26 - - - - buttonReleased: - - - 9 - - 44 - - - - buttonPressed: - - - 1 - - 45 - - - - buttonReleased: - - - 8 - - 46 - - - - buttonReleased: - - - 7 - - 47 - - - - buttonReleased: - - - 8 - - 49 - - - - buttonReleased: - - - 7 - - 50 - - - - buttonReleased: - - - 9 - - 51 - - - - buttonPressed: - - - 1 - - 52 - - - - buttonReleased: - - - 9 - - 54 - - - - buttonReleased: - - - 7 - - 55 - - - - buttonPressed: - - - 1 - - 56 - - - - buttonReleased: - - - 8 - - 57 - - - - buttonPressed: - - - 7 - - 60 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - left - - - 12 - - - right - - - 17 - - - up - - - 22 - - - down - - - 43 - - - push2 - - - 48 - - - push1 - - - 53 - - - push3 - - - 58 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 12.IBPluginDependency - 17.IBPluginDependency - 22.IBPluginDependency - 4.IBPluginDependency - 43.IBPluginDependency - 48.IBPluginDependency - 53.IBPluginDependency - 58.IBPluginDependency - - - YES - OverlayViewController - UIResponder - {{0, 273}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 60 - - - - YES - - OverlayViewController - UIViewController - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - id - id - - - - popoverController - id - - - IBProjectSource - ../../cocoaTouch/OverlayViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj - 3 - - YES - - YES - arrowDown.png - arrowLeft.png - arrowRight.png - arrowUp.png - joyPush.png - menuCorner.png - - - YES - {64, 64} - {64, 64} - {64, 64} - {64, 64} - {64, 64} - {64, 64} - - - 87 - - diff -r f589230fa21b -r 59dbd31e9953 cocoaTouch/xib/OverlayViewController.xib --- a/cocoaTouch/xib/OverlayViewController.xib Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,947 +0,0 @@ - - - - 800 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 87 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 268 - {{0, 237}, {39, 53}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - arrowLeft.png - - - - - 268 - {{75, 237}, {39, 54}} - - NO - NO - 1 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowRight.png - - - - - 265 - {{416, 227}, {64, 64}} - - NO - NO - 5 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyPush.png - - - - - 265 - {{368, 207}, {64, 64}} - - NO - NO - 6 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - - 265 - {{344, 256}, {64, 64}} - - NO - NO - 4 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - - 268 - {{29, 207}, {53, 39}} - - NO - NO - 2 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowUp.png - - - - - 268 - {{29, 281}, {53, 39}} - - NO - NO - 3 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowDown.png - - - - - 289 - {{412, -6}, {72, 64}} - - NO - 10 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - menuCorner.png - - - - {480, 320} - - - 3 - MSAwAA - - NO - YES - NO - YES - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - 1 - - 8 - - - - buttonReleased: - - - 9 - - 9 - - - - buttonReleased: - - - 7 - - 10 - - - - buttonReleased: - - - 8 - - 11 - - - - buttonReleased: - - - 8 - - 13 - - - - buttonReleased: - - - 9 - - 14 - - - - buttonPressed: - - - 1 - - 15 - - - - buttonReleased: - - - 7 - - 16 - - - - buttonReleased: - - - 9 - - 18 - - - - buttonPressed: - - - 1 - - 19 - - - - buttonReleased: - - - 8 - - 20 - - - - buttonReleased: - - - 7 - - 21 - - - - buttonReleased: - - - 8 - - 23 - - - - buttonReleased: - - - 9 - - 24 - - - - buttonPressed: - - - 1 - - 25 - - - - buttonReleased: - - - 7 - - 26 - - - - buttonReleased: - - - 9 - - 44 - - - - buttonPressed: - - - 1 - - 45 - - - - buttonReleased: - - - 8 - - 46 - - - - buttonReleased: - - - 7 - - 47 - - - - buttonReleased: - - - 8 - - 49 - - - - buttonReleased: - - - 7 - - 50 - - - - buttonReleased: - - - 9 - - 51 - - - - buttonPressed: - - - 1 - - 52 - - - - buttonReleased: - - - 9 - - 54 - - - - buttonReleased: - - - 7 - - 55 - - - - buttonPressed: - - - 1 - - 56 - - - - buttonReleased: - - - 8 - - 57 - - - - buttonPressed: - - - 7 - - 60 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - left - - - 12 - - - right - - - 17 - - - up - - - 22 - - - down - - - 43 - - - push2 - - - 48 - - - push1 - - - 53 - - - push3 - - - 58 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 12.IBPluginDependency - 17.IBPluginDependency - 22.IBPluginDependency - 4.IBPluginDependency - 43.IBPluginDependency - 48.IBPluginDependency - 53.IBPluginDependency - 58.IBPluginDependency - - - YES - OverlayViewController - UIResponder - {{222, 756}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 62 - - - - YES - - OverlayViewController - UIViewController - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - id - id - - - - popoverController - id - - - IBProjectSource - ../../cocoaTouch/OverlayViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSNetServices.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPort.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSStream.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSXMLParser.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj - 3 - - YES - - YES - arrowDown.png - arrowLeft.png - arrowRight.png - arrowUp.png - joyPush.png - menuCorner.png - - - YES - {64, 64} - {64, 64} - {64, 64} - {64, 64} - {64, 64} - {64, 64} - - - 87 - - diff -r f589230fa21b -r 59dbd31e9953 hedgewars/options.inc --- a/hedgewars/options.inc Thu Jun 17 19:57:51 2010 +0200 +++ b/hedgewars/options.inc Thu Jun 17 20:30:39 2010 +0200 @@ -32,7 +32,8 @@ {$DEFINE SDL_MIXER_NEWER} {$DEFINE SDL_IMAGE_NEWER} {$DEFINE HWLIBRARY} - {$DEFINE GLunit:=gles11} + {$DEFINE GLunit:=gles11} + {$DEFINE DOWNSCALE} {$ENDIF} {$IFNDEF DARWIN} diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/CMakeLists.txt Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,41 @@ +find_package(OpenAL REQUIRED) +find_package(OggVorbis REQUIRED) +include_directories(${OPENAL_INCLUDE_DIR}) +include_directories(${OGGVORBIS_INCLUDE_DIRS}) + +#set destination directory for library +set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) + +#list of source files for libraries +set(openal_src + openalbridge.c loaders.c wrappers.c errlib.c +) + +#build a static library for human systems +set (build_type STATIC) + +#visualstudio and windows in general don't like static linking, so we're building the library in shared mode +if(WIN32) +#workaround for visualstudio (wants headers in the source list) + set(openal_src + openalbridge.h openalbridge_t.h loaders.h wrappers.h globals.h oggvorbis.h errlib.h ${openal_src} + ) +#deps for the shared library + link_libraries(${VORBISFILE_LIBRARY}) + link_libraries(${VORBIS_LIBRARY}) + link_libraries(${OGG_LIBRARY}) + link_libraries(${OPENAL_LIBRARY}) +#build a shared library + set (build_type SHARED) +endif() + +#compiles and links actual library +add_library (openalbridge ${build_type} ${openal_src}) + +if(WIN32) +if(MSVC) + SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def) +endif(MSVC) +#install it in the executable directory + install(TARGETS openalbridge DESTINATION bin) +endif(WIN32) diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/commands.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/commands.c Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,224 @@ +/* + * commands.c + * Hedgewars + * + * Created by Vittorio on 13/06/10. + * Copyright 2010 __MyCompanyName__. All rights reserved. + * + */ + +#include "commands.h" +#include "wrappers.h" + +ALfloat old_gain; +extern ALuint *Sources; +extern ALuint cache_size, cache_index, sources_number; +extern ALboolean instances_number; +extern al_sound_t *the_sounds; + +void openal_pausesound (uint32_t index) { + if (openal_ready() == AL_TRUE && index < cache_size) + alSourcePause(Sources[the_sounds[index].source_index]); +} + + +void openal_stopsound (uint32_t index) { + if (openal_ready() == AL_TRUE && index < cache_size) + alSourceStop(Sources[the_sounds[index].source_index]); +} + + +void openal_playsound (unsigned int index) { + ALboolean needsSource = AL_TRUE; + ALfloat SourcePosition[] = { 0.0, 0.0, 0.0 }; + ALfloat SourceVelocity[] = { 0.0, 0.0, 0.0 }; + ALint state; + int i, j; + + if (openal_ready() == AL_TRUE && index < cache_size) { + // check if sound has already a source + if (the_sounds[index].source_index != -1) { + // it has a source, check it's not playing + alGetSourcei(Sources[the_sounds[index].source_index], AL_SOURCE_STATE, &state); + if (state != AL_PLAYING && state != AL_PAUSED) { + // it is not being played, so we can use it safely + needsSource = AL_FALSE; + } + // else it is being played, so we have to allocate a new source for this buffer + } + + if (needsSource) { +#ifdef DEBUG + fprintf(stderr,"(Bridge Debug) - looking for a source for sound %d\n", index); +#endif + for (i = 0; i < sources_number; i++) { + // let's iterate on Sources until we find a source that is not playing + alGetSourcei(Sources[i], AL_SOURCE_STATE, &state); + if (state != AL_PLAYING && state != AL_PAUSED) { + // let's iterate on the_sounds until we find the sound using that source + for (j = 0; j < cache_size; j++) { + if (the_sounds[j].source_index == i) { + the_sounds[j].source_index = -1; + break; + } + } + // here we know that no-one is using that source so we can use it + break; + } + } + + if (i == sources_number) { + // this means all sources are busy + } + + // set source properties that it will use when it's in playback + alSourcei (Sources[i], AL_BUFFER, the_sounds[index].buffer); + alSourcef (Sources[i], AL_PITCH, 1.0f); + alSourcef (Sources[i], AL_GAIN, 1.0f); + alSourcefv(Sources[i], AL_POSITION, SourcePosition); + alSourcefv(Sources[i], AL_VELOCITY, SourceVelocity); + alSourcei (Sources[i], AL_LOOPING, 0); + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge ERROR) - failed to set Source properties\n"); + return; + } + the_sounds[index].source_index = i; + } + + alSourcePlay(Sources[the_sounds[index].source_index]); + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge Warning) - failed to play sound %d\n", index); + return; + } + + the_sounds[index].stats++; + } +} + +void openal_toggleloop (uint32_t index) { + ALint loop; + + if (openal_ready() == AL_TRUE && index < cache_size) { + alGetSourcei (Sources[the_sounds[index].source_index], AL_LOOPING, &loop); + alSourcei (Sources[the_sounds[index].source_index], AL_LOOPING, !((uint8_t) loop) & 0x00000001); + } +} + + +void openal_setvolume (uint32_t index, float gain) { + if (openal_ready() == AL_TRUE && index < cache_size) + alSourcef (Sources[the_sounds[index].source_index], AL_GAIN, gain); +} + + +void openal_setglobalvolume (float gain) { + if (openal_ready() == AL_TRUE) + alListenerf (AL_GAIN, gain); +} + +void openal_togglemute () { + ALfloat gain; + + if (openal_ready() == AL_TRUE) { + alGetListenerf (AL_GAIN, &gain); + if (gain > 0) { + old_gain = gain; + gain = 0; + } else + gain = old_gain; + + alListenerf (AL_GAIN, gain); + } +} + +// Fade in or out by calling a helper thread +void openal_fade (uint32_t index, uint16_t quantity, al_fade_t direction) { +#ifndef _WIN32 + pthread_t thread; +#else + HANDLE Thread; +#endif + fade_t *fade; + + if (openal_ready() == AL_TRUE && index < cache_size) { + fade = (fade_t*) Malloc(sizeof(fade_t)); + fade->index = index; + fade->quantity = quantity; + fade->type = direction; + +#ifndef _WIN32 + pthread_create(&thread, NULL, (void *)helper_fade, (void *)fade); + pthread_detach(thread); +#else + Thread = (HANDLE) _beginthread((void *)helper_fade, 0, (void *)fade); +#endif + } +} + +void openal_setposition (uint32_t index, float x, float y, float z) { + if (openal_ready() == AL_TRUE && index < cache_size) + alSource3f(Sources[the_sounds[index].source_index], AL_POSITION, x, y, z);; +} + +void helper_fade(void *tmp) { + ALfloat gain; + ALfloat target_gain; + fade_t *fade; + uint32_t index; + uint16_t quantity; + al_fade_t type; + + fade = tmp; + index = fade->index; + quantity = fade->quantity; + type = fade->type; + free (fade); + + if (type == AL_FADE_IN) { +#ifdef DEBUG + fprintf(stderr,"(Bridge Info) - Fade-in in progress [index %d quantity %d]", index, quantity); +#endif + + // save the volume desired after the fade + alGetSourcef(Sources[the_sounds[index].source_index], AL_GAIN, &target_gain); + if (target_gain > 1.0f || target_gain <= 0.0f) + target_gain = 1.0f; + + for (gain = 0.0f ; gain <= target_gain; gain += (float) quantity/10000) { +#ifdef TRACE + fprintf(stderr,"(Bridge Debug) - Fade-in set gain to %f\n", gain); +#endif + alSourcef(Sources[the_sounds[index].source_index], AL_GAIN, gain); + usleep(10000); + } + } else { + alGetSourcef(Sources[the_sounds[index].source_index], AL_GAIN, &target_gain); + + for (gain = target_gain; gain >= 0.00f; gain -= (float) quantity/10000) { +#ifdef TRACE + fprintf(stderr,"(Bridge Debug) - Fade-out set gain to %f\n", gain); +#endif + alSourcef(Sources[the_sounds[index].source_index], AL_GAIN, gain); + usleep(10000); + } + + if (AL_NO_ERROR != alGetError()) + fprintf(stderr,"(Bridge Warning) - Failed to set fade-out effect\n"); + + // stop that sound and reset its volume + alSourceStop (Sources[the_sounds[index].source_index]); + alSourcef (Sources[the_sounds[index].source_index], AL_GAIN, target_gain); + } + + if (AL_NO_ERROR != alGetError()) + fprintf(stderr,"(Bridge Warning) - Failed to set fade effect\n"); + +#ifndef _WIN32 + pthread_exit(NULL); +#else + _endthread(); +#endif +} + diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/commands.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/commands.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,55 @@ +/* + * commands.h + * Hedgewars + * + * Created by Vittorio on 13/06/10. + * Copyright 2010 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef _OALB_COMMANDS_H +#define _OALB_COMMANDS_H + +#include "openalbridge_t.h" +#include "openalbridge.h" + + +#define openal_fadein(x,y) openal_fade(x,y,AL_FADE_IN) +#define openal_fadeout(x,y) openal_fade(x,y,AL_FADE_OUT) +#define openal_playsound_loop(x,y) openal_playsound(x) \ + if (y != 0) \ + openal_toggleloop(x); +#ifdef __CPLUSPLUS +extern "C" { +#endif + + // play, pause, stop a single sound source + void openal_pausesound (unsigned int index); + void openal_stopsound (unsigned int index); + + // play a sound and set whether it should loop or not (0/1) + void openal_playsound (unsigned int index); + + void openal_freesound (unsigned int index); + + // set or unset the looping property for a sound source + void openal_toggleloop (unsigned int index); + + // set position and volume of a sound source + void openal_setposition (unsigned int index, float x, float y, float z); + void openal_setvolume (unsigned int index, float gain); + + // set volume for all sounds (gain interval is [0-1]) + void openal_setglobalvolume (float gain); + + // mute or unmute all sounds + void openal_togglemute (void); + + // fade effect, + void openal_fade (unsigned int index, unsigned short int quantity, al_fade_t direction); + +#ifdef __CPLUSPLUS +} +#endif + +#endif /*_OALB_COMMANDS_H*/ \ No newline at end of file diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/globals.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/globals.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,94 @@ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#ifndef _OALB_GLOBALS_H +#define _OALB_GLOBALS_H + +#include +#include +#include "al.h" + +#ifndef _WIN32 +#include +#include +#else +#include +#endif + + +// 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. [Wu Yongwei] +#ifndef _SLEEP_H +#define _SLEEP_H +#ifdef _WIN32 +# if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__)) +# include +# define sleep(t) _sleep((t) * 1000) +# else +# define WIN32_LEAN_AND_MEAN +# include +# define sleep(t) Sleep((t) * 1000) +# endif +# ifndef _NEED_SLEEP_ONLY +# define msleep(t) Sleep(t) +# define usleep(t) Sleep((t) / 1000) +# endif +#else +# include +# ifndef _NEED_SLEEP_ONLY +# define msleep(t) usleep((t) * 1000) +# endif +#endif +#endif // _SLEEP_H + + +// check compiler requirements +#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +#warning __BIG_ENDIAN__ or __LITTLE_ENDIAN__ not found, going to set __LITTLE_ENDIAN__ as default +#define __LITTLE_ENDIAN__ 1 +#endif + +/* use byteswap macros from the host system, hopefully optimized ones ;-) + * or define our own version, simple, stupid, straight-forward... */ +#ifdef HAVE_BYTESWAP_H +#include +#else +#define bswap_16(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) +#define bswap_32(x) (((x & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ + ((x & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) +#endif /* HAVE_BYTESWAP_H */ + +/* swap numbers accordingly to architecture automatically */ +#ifdef __LITTLE_ENDIAN__ +#define ENDIAN_LITTLE_32(x) x +#define ENDIAN_BIG_32(x) bswap_32(x) +#define ENDIAN_LITTLE_16(x) x +#define ENDIAN_BIG_16(x) bswap_16(x) +#elif __BIG_ENDIAN__ +#define ENDIAN_LITTLE_32(x) bswap_32(x) +#define ENDIAN_BIG_32(x) x +#define ENDIAN_LITTLE_16(x) bswap_16(x) +#define ENDIAN_BIG_16(x) x +#endif + +/* file format defines */ +#define OGG_FILE_FORMAT 0x4F676753 +#define WAV_FILE_FORMAT 0x52494646 +#define WAV_HEADER_SUBCHUNK2ID 0x64617461 + + +#endif /*_OALB_GLOBALS_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/loaders.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/loaders.c Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,238 @@ +/* +* OpenAL Bridge - a simple portable library for OpenAL interface +* Copyright (c) 2009 Vittorio Giovara +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser 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 +*/ + +#include "loaders.h" +#include "wrappers.h" +#include "vorbis/vorbisfile.h" +#include "openalbridge_t.h" + + +int load_wavpcm (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq) { + WAV_header_t WAVHeader; + FILE *wavfile; + int32_t t; + uint32_t n = 0; + uint8_t sub0, sub1, sub2, sub3; + + wavfile = Fopen(filename, "rb"); + + fread(&WAVHeader.ChunkID, sizeof(uint32_t), 1, wavfile); /*RIFF*/ + fread(&WAVHeader.ChunkSize, sizeof(uint32_t), 1, wavfile); + fread(&WAVHeader.Format, sizeof(uint32_t), 1, wavfile); /*WAVE*/ + +#ifdef DEBUG + fprintf(stderr, "ChunkID: %X\n", ENDIAN_BIG_32(WAVHeader.ChunkID)); + fprintf(stderr, "ChunkSize: %d\n", ENDIAN_LITTLE_32(WAVHeader.ChunkSize)); + fprintf(stderr, "Format: %X\n", ENDIAN_BIG_32(WAVHeader.Format)); +#endif + + fread(&WAVHeader.Subchunk1ID, sizeof(uint32_t), 1, wavfile); /*fmt */ + fread(&WAVHeader.Subchunk1Size, sizeof(uint32_t), 1, wavfile); + fread(&WAVHeader.AudioFormat, sizeof(uint16_t), 1, wavfile); + fread(&WAVHeader.NumChannels, sizeof(uint16_t), 1, wavfile); + fread(&WAVHeader.SampleRate, sizeof(uint32_t), 1, wavfile); + fread(&WAVHeader.ByteRate, sizeof(uint32_t), 1, wavfile); + fread(&WAVHeader.BlockAlign, sizeof(uint16_t), 1, wavfile); + fread(&WAVHeader.BitsPerSample, sizeof(uint16_t), 1, wavfile); + +#ifdef DEBUG + fprintf(stderr, "Subchunk1ID: %X\n", ENDIAN_BIG_32(WAVHeader.Subchunk1ID)); + fprintf(stderr, "Subchunk1Size: %d\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk1Size)); + fprintf(stderr, "AudioFormat: %d\n", ENDIAN_LITTLE_16(WAVHeader.AudioFormat)); + fprintf(stderr, "NumChannels: %d\n", ENDIAN_LITTLE_16(WAVHeader.NumChannels)); + fprintf(stderr, "SampleRate: %d\n", ENDIAN_LITTLE_32(WAVHeader.SampleRate)); + fprintf(stderr, "ByteRate: %d\n", ENDIAN_LITTLE_32(WAVHeader.ByteRate)); + fprintf(stderr, "BlockAlign: %d\n", ENDIAN_LITTLE_16(WAVHeader.BlockAlign)); + fprintf(stderr, "BitsPerSample: %d\n", ENDIAN_LITTLE_16(WAVHeader.BitsPerSample)); +#endif + + /*remove useless header chunks by looking for the WAV_HEADER_SUBCHUNK2ID integer */ + do { + t = fread(&sub0, sizeof(uint8_t), 1, wavfile); + if(sub0 == 0x64) { + t = fread(&sub1, sizeof(uint8_t), 1, wavfile); + if(sub1 == 0x61) { + t = fread(&sub2, sizeof(uint8_t), 1, wavfile); + if(sub2 == 0x74) { + t = fread(&sub3, sizeof(uint8_t), 1, wavfile); + if(sub3 == 0x61) { + WAVHeader.Subchunk2ID = WAV_HEADER_SUBCHUNK2ID; + break; + } + } + } + } + + if (t <= 0) { + // eof + fprintf(stderr,"(Bridge Error) - wrong WAV header\n"); + return -1; + } + } while (1); + + fread(&WAVHeader.Subchunk2Size, sizeof(uint32_t), 1, wavfile); + +#ifdef DEBUG + fprintf(stderr, "Subchunk2ID: %X\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk2ID)); + fprintf(stderr, "Subchunk2Size: %d\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); +#endif + + *data = (char*) Malloc (sizeof(char) * ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); + + /*read the actual sound data*/ + do { + n += fread(&((*data)[n]), sizeof(uint8_t), 4, wavfile); + } while (n < ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); + + fclose(wavfile); + +#ifdef DEBUG + fprintf(stderr,"(Bridge Info) - WAV data loaded\n"); +#endif + + /*set parameters for OpenAL*/ + /*Valid formats are AL_FORMAT_MONO8, AL_FORMAT_MONO16, AL_FORMAT_STEREO8, and AL_FORMAT_STEREO16*/ + if (ENDIAN_LITTLE_16(WAVHeader.NumChannels) == 1) { + if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 8) + *format = AL_FORMAT_MONO8; + else { + if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16) + *format = AL_FORMAT_MONO16; + else { + fprintf(stderr,"(Bridge Error) - wrong WAV header [bitsample value]\n"); + return -2; + } + } + } else { + if (ENDIAN_LITTLE_16(WAVHeader.NumChannels) == 2) { + if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 8) + *format = AL_FORMAT_STEREO8; + else { + if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16) + *format = AL_FORMAT_STEREO16; + else { + fprintf(stderr,"(Bridge Error) - wrong WAV header [bitsample value]\n"); + return -2; + } + } + } else { + fprintf(stderr,"(Bridge Error) - wrong WAV header [format value]\n"); + return -2; + } + } + + *bitsize = ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size); + *freq = ENDIAN_LITTLE_32(WAVHeader.SampleRate); + return 0; +} + + +int load_oggvorbis (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq) { + /*implementation inspired from http://www.devmaster.net/forums/showthread.php?t=1153 */ + + /*ogg handle*/ + FILE *oggFile; + /*stream handle*/ + OggVorbis_File oggStream; + /*some formatting data*/ + vorbis_info *vorbisInfo; + /*length of the decoded data*/ + int64_t pcm_length; + /*other vars*/ + int section, result, size, endianness; +#ifdef DEBUG + int i; + /*other less useful data*/ + vorbis_comment *vorbisComment; +#endif + + oggFile = Fopen(filename, "rb"); + result = ov_open_callbacks(oggFile, &oggStream, NULL, 0, OV_CALLBACKS_DEFAULT); + if (result < 0) { + fprintf(stderr,"(Bridge Error) - ov_open_callbacks() failed with %X\n", result); + ov_clear(&oggStream); + return -1; + } + + /*load OGG header and determine the decoded data size*/ + vorbisInfo = ov_info(&oggStream, -1); + pcm_length = ov_pcm_total(&oggStream, -1) << vorbisInfo->channels; + +#ifdef DEBUG + vorbisComment = ov_comment(&oggStream, -1); + fprintf(stderr, "Version: %d\n", vorbisInfo->version); + fprintf(stderr, "Channels: %d\n", vorbisInfo->channels); + fprintf(stderr, "Rate (Hz): %ld\n", vorbisInfo->rate); + fprintf(stderr, "Bitrate Upper: %ld\n", vorbisInfo->bitrate_upper); + fprintf(stderr, "Bitrate Nominal: %ld\n", vorbisInfo->bitrate_nominal); + fprintf(stderr, "Bitrate Lower: %ld\n", vorbisInfo->bitrate_lower); + fprintf(stderr, "Bitrate Windows: %ld\n", vorbisInfo->bitrate_window); + fprintf(stderr, "Vendor: %s\n", vorbisComment->vendor); + fprintf(stderr, "PCM data size: %lld\n", pcm_length); + fprintf(stderr, "# comment: %d\n", vorbisComment->comments); + for (i = 0; i < vorbisComment->comments; i++) + fprintf(stderr, "\tComment %d: %s\n", i, vorbisComment->user_comments[i]); +#endif + + /*allocates enough room for the decoded data*/ + *data = (char*) Malloc (sizeof(char) * pcm_length); + + /*there *should* not be ogg at 8 bits*/ + if (vorbisInfo->channels == 1) + *format = AL_FORMAT_MONO16; + else { + if (vorbisInfo->channels == 2) + *format = AL_FORMAT_STEREO16; + else { + fprintf(stderr,"(Bridge Error) - wrong OGG header [channel %d]\n", vorbisInfo->channels); + ov_clear(&oggStream); + return -2; + } + } + + size = 0; +#ifdef __LITTLE_ENDIAN__ + endianness = 0; +#elif __BIG_ENDIAN__ + endianness = 1; +#endif + while (size < pcm_length) { + /*ov_read decodes the ogg stream and storse the pcm in data*/ + result = ov_read (&oggStream, *data + size, pcm_length - size, endianness, 2, 1, §ion); + if (result > 0) { + size += result; + } else { + if (result == 0) + break; + else { + fprintf(stderr,"(Bridge Error) - End of file from OGG stream\n"); + ov_clear(&oggStream); + return -3; + } + } + } + + /*set the last fields*/ + *bitsize = size; + *freq = vorbisInfo->rate; + + /*cleaning time (ov_clear also closes file handler)*/ + ov_clear(&oggStream); + + return 0; +} diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/loaders.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/loaders.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,27 @@ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#include "globals.h" + +#ifndef _OALB_LOADERS_H +#define _OALB_LOADERS_H + +int load_wavpcm (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq); +int load_oggvorbis (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq); + +#endif /*_OALB_LOADERS_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/openalbridge.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/openalbridge.c Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,265 @@ +/* +* OpenAL Bridge - a simple portable library for OpenAL interface +* Copyright (c) 2009 Vittorio Giovara +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser 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 +*/ + +#include "openalbridge.h" +#include "globals.h" +#include "al.h" +#include "alc.h" +#include "wrappers.h" +#include "loaders.h" +#include "string.h" + +// Sources are points emitting sound, their number is limited, but a single source can play many buffers +// Buffers hold sound data and are unlimited +ALuint *Sources; +ALuint cache_size, cache_index, sources_number; +ALboolean instances_number; +al_sound_t *the_sounds; +ALint cache_pointer; + +// Initialize an OpenAL contex and allocate memory space for data and buffers +// It can be called twice to increase the cache size +int openal_init (int memorysize) { + ALCcontext *context; + ALCdevice *device; + int i; + + // reuse old context and resize the existing + if (openal_ready() == AL_TRUE) { + cache_size += memorysize; + fprintf(stderr,"(Bridge Info) - already initialized, resizing cache to %d\n", cache_size); + the_sounds = (al_sound_t *)Realloc (the_sounds, sizeof(al_sound_t) * cache_size); + for (i = cache_size - memorysize; i < cache_size; i++) { + the_sounds[i].filename = NULL; + the_sounds[i].buffer = -1; + the_sounds[i].source_index = -1; + the_sounds[i].stats = 0; + } + instances_number++; + return AL_TRUE; + } + + cache_pointer = 0; + instances_number++; + + // set the memory dimentsion and the increment width when reallocating + if (memorysize <= 0) + cache_size = 50; + else + cache_size = memorysize; + + // open hardware device if present + device = alcOpenDevice(NULL); + sources_number = 16; + if (device == NULL) { + fprintf(stderr,"(Bridge Warning) - failed to open sound device, using software renderer\n"); + device = alcOpenDevice("Generic Software"); + sources_number = 32; + if (device == NULL) { + fprintf(stderr,"(Bridge ERROR) - failed to start software renderer, sound will be disabled\n"); + return -1; + } + } + + fprintf(stderr,"(Bridge Info) - output device: %s\n", alcGetString(device, ALC_DEVICE_SPECIFIER)); + + context = alcCreateContext(device, NULL); + alcMakeContextCurrent(context); + alcProcessContext(context); + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge ERROR) - Failed to create a new contex\n"); + alcMakeContextCurrent(NULL); + alcDestroyContext(context); + alcCloseDevice(device); + return -2; + } + + Sources = (ALuint *)Malloc (sizeof(ALuint) * sources_number); + alGenSources(sources_number, Sources); + + // set the listener gain, position (on xyz axes), velocity (one value for each axe) and orientation + // Position, Velocity and Orientation of the listener + ALfloat ListenerPos[] = {0.0, 0.0, 0.0}; + ALfloat ListenerVel[] = {0.0, 0.0, 0.0}; + ALfloat ListenerOri[] = {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}; + + alListenerf (AL_GAIN, 1.0f ); + alListenerfv(AL_POSITION, ListenerPos); + alListenerfv(AL_VELOCITY, ListenerVel); + alListenerfv(AL_ORIENTATION, ListenerOri); + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge ERROR) - Failed to set Listener properties\n"); + return -3; + } + + the_sounds = (al_sound_t *)Malloc (sizeof(al_sound_t) * cache_size); + for (i = 0; i < cache_size; i++) { + the_sounds[i].filename = NULL; + the_sounds[i].buffer = -1; + the_sounds[i].source_index = -1; + the_sounds[i].stats = 0; + } + + alGetError(); + return AL_TRUE; +} + + +// Stop all sounds, deallocate all memory and close OpenAL context +void openal_close (void) { + ALCcontext *context; + ALCdevice *device; + int i; + + if (instances_number == 0) { + fprintf(stderr,"(Bridge Warning) - OpenAL not initialized\n"); + return; + } + + instances_number--; + if (instances_number > 0) { + return; + } + + //TODO: free other stuff also + for (i = 0; i < cache_size; i++) + alDeleteBuffers (1, &the_sounds[i].buffer); + free(the_sounds); + + alSourceStopv (sources_number, Sources); + alDeleteSources (sources_number, Sources); + + free(Sources); + + context = alcGetCurrentContext(); + device = alcGetContextsDevice(context); + + alcMakeContextCurrent(NULL); + alcDestroyContext(context); + alcCloseDevice(device); + + fprintf(stderr,"(Bridge Info) - closed\n"); + + return; +} + + +ALboolean openal_ready (void) { + if (instances_number >= 1) + return AL_TRUE; + else + return AL_FALSE; +} + + +// Open a file, load into memory and allocate the Source buffer for playing +int openal_loadfile (const char *filename){ + ALenum format, error; + ALsizei bitsize, freq; + uint32_t fileformat; + al_sound_t soundData; + int len, i; + char *data; + FILE *fp; + + if (openal_ready() == AL_FALSE) { + fprintf(stderr,"(Bridge Warning) - not initialized\n"); + return -1; + } + + // if this sound is already loaded return the index from the_sounds + len = strlen(filename); + for (i = 0; i < cache_size; i++) { + if (the_sounds[i].filename != NULL && strncmp(the_sounds[i].filename, filename, len) == 0) { +#ifdef DEBUG + fprintf(stderr,"(Bridge Debug) - sound %d is already loaded\n", i); +#endif + return i; + } + } + + if (cache_pointer >= cache_size) { + fprintf(stderr,"(Bridge ERROR) - Cache size limit reached; consider allocating more space\n", filename); + return -2; + } + + // detect the file format, as written in the first 4 bytes of the header + fp = Fopen (filename, "rb"); + + if (fp == NULL) { + fprintf(stderr,"(Bridge ERROR) - File %s not loaded\n", filename); + return -3; + } + + error = fread (&fileformat, sizeof(uint32_t), 1, fp); + fclose (fp); + + if (error < 0) { + fprintf(stderr,"(Bridge ERROR) - File %s is too short\n", filename); + return -4; + } + + switch (ENDIAN_BIG_32(fileformat)) { + case OGG_FILE_FORMAT: + error = load_oggvorbis (filename, &format, &data, &bitsize, &freq); + break; + case WAV_FILE_FORMAT: + error = load_wavpcm (filename, &format, &data, &bitsize, &freq); + break; + default: + fprintf(stderr,"(Bridge ERROR) - File format (%08X) not supported\n", ENDIAN_BIG_32(fileformat)); + return -5; + break; + } + + if (error != 0) { + fprintf(stderr,"(Bridge ERROR) - error loading file %s\n", filename); + free(data); + return -6; + } + + alGenBuffers(1, &soundData.buffer); + soundData.filename = filename; + soundData.source_index = -1; + soundData.stats = 0; + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge ERROR) - Failed to allocate memory for buffers\n"); + return -5; + } + + // copy pcm data in one buffer and free it + alBufferData(soundData.buffer, format, data, bitsize, freq); + free(data); + + if (AL_NO_ERROR != alGetError()) { + fprintf(stderr,"(Bridge ERROR) - Failed to write data to buffers\n"); + return -8; + } + + // clear any AL errors beforehand + alGetError(); + + fprintf(stderr,"(Bridge Info) - successfully loaded %s\n", filename); + + // returns the index of the source you just loaded, increments it and exits + the_sounds[cache_pointer] = soundData; + return cache_pointer++; +} diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/openalbridge.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/openalbridge.def Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,20 @@ +LIBRARY "openalbridge" +EXPORTS + openal_init + openal_close + openal_ready + openal_loadfile + openal_playsound + openal_pausesound + openal_stopsound + openal_playsound_loop + openal_stopsound_free + openal_freesound + openal_toggleloop + openal_setvolume + openal_setglobalvolume + openal_togglemute + openal_fade + openal_fadein + openal_fadeout + diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/openalbridge.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/openalbridge.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,48 @@ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#ifndef _OALB_INTERFACE_H +#define _OALB_INTERFACE_H + +#include "openalbridge_t.h" +#include "commands.h" + +#ifdef __CPLUSPLUS +extern "C" { +#endif + + // init audio context and allocate memory + int openal_init (int memorysize); + + // close audio subsytem and free memory + void openal_close (void); + + // check if openal_init has been called + char openal_ready (void); + + // load an audio file into memory and map it to abuffer + int openal_loadfile (const char *filename); + + + /******* other functions continue in commands.h *******/ + +#ifdef __CPLUSPLUS +} +#endif + +#endif /*_OALB_INTERFACE_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/openalbridge_t.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/openalbridge_t.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,74 @@ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#include +#include "al.h" + +#ifndef _OALB_INTERFACE_TYPES_H +#define _OALB_INTERFACE_TYPES_H + +enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT}; +typedef enum al_fade_enum al_fade_t; + + +// data type to handle which source source is playing what +#pragma pack(1) +typedef struct _al_sound_t { + const char *filename; // name of the sound file + ALuint buffer; // actual sound content + uint32_t source_index; // index of the associated source + uint32_t stats; // number of times the sound has been played +} al_sound_t; +#pragma pack() + + +// data type for passing data between threads +#pragma pack(1) +typedef struct _fade_t { + uint32_t index; + uint16_t quantity; + al_fade_t type; +} fade_t; +#pragma pack() + + +// data type for WAV header +#pragma pack(1) +typedef struct _WAV_header_t { + uint32_t ChunkID; + uint32_t ChunkSize; + uint32_t Format; + uint32_t Subchunk1ID; + uint32_t Subchunk1Size; + uint16_t AudioFormat; + uint16_t NumChannels; + uint32_t SampleRate; + uint32_t ByteRate; + uint16_t BlockAlign; + uint16_t BitsPerSample; + uint32_t Subchunk2ID; + uint32_t Subchunk2Size; +} WAV_header_t; +#pragma pack() + + +#ifdef __CPLUSPLUS +} +#endif + +#endif /*_OALB_INTERFACE_TYPES_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/wrappers.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/wrappers.c Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,57 @@ +/* +* OpenAL Bridge - a simple portable library for OpenAL interface +* Copyright (c) 2009 Vittorio Giovara +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser 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 +*/ + +#include "wrappers.h" +#include "openalbridge_t.h" + + +void *Malloc (size_t nbytes) { + void *aptr; + + if ((aptr = malloc(nbytes)) == NULL) { + fprintf(stderr,"(Bridge FATAL) - not enough memory\n"); + abort(); + } + + return aptr; +} + + +void *Realloc (void *aptr, size_t nbytes) { + aptr = realloc(aptr, nbytes); + + if (aptr == NULL) { + fprintf(stderr,"(Bridge FATAL) - not enough memory\n"); + abort(); + } + + return aptr; +} + + +FILE *Fopen (const char *fname, char *mode) { + FILE *fp; + + fp = fopen(fname,mode); + if (fp == NULL) + fprintf(stderr,"(Bridge Error) - can't open file %s in mode '%s'\n", fname, mode); + + return fp; +} + + diff -r f589230fa21b -r 59dbd31e9953 misc/libopenalbridge/wrappers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/libopenalbridge/wrappers.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,30 @@ +/* + * OpenAL Bridge - a simple portable library for OpenAL interface + * Copyright (c) 2009 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#ifndef _OALB_WRAPPERS_H +#define _OALB_WRAPPERS_H + +#include "globals.h" +#include "openalbridge_t.h" + +void *Malloc (size_t nbytes); +void *Realloc (void *aptr, size_t nbytes); +FILE *Fopen (const char *fname, char *mode); +void helper_fade (void *tmp); + +#endif /*_OALB_WRAPPERS_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/CMakeLists.txt --- a/misc/openalbridge/CMakeLists.txt Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -find_package(OpenAL REQUIRED) -find_package(OggVorbis REQUIRED) -include_directories(${OPENAL_INCLUDE_DIR}) -include_directories(${OGGVORBIS_INCLUDE_DIRS}) - -#set destination directory for library -set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) - -#list of source files for libraries -set(openal_src - openalbridge.c loaders.c wrappers.c errlib.c -) - -#build a static library for human systems -set (build_type STATIC) - -#visualstudio and windows in general don't like static linking, so we're building the library in shared mode -if(WIN32) -#workaround for visualstudio (wants headers in the source list) - set(openal_src - openalbridge.h openalbridge_t.h loaders.h wrappers.h globals.h oggvorbis.h errlib.h ${openal_src} - ) -#deps for the shared library - link_libraries(${VORBISFILE_LIBRARY}) - link_libraries(${VORBIS_LIBRARY}) - link_libraries(${OGG_LIBRARY}) - link_libraries(${OPENAL_LIBRARY}) -#build a shared library - set (build_type SHARED) -endif() - -#compiles and links actual library -add_library (openalbridge ${build_type} ${openal_src}) - -if(WIN32) -if(MSVC) - SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def) -endif(MSVC) -#install it in the executable directory - install(TARGETS openalbridge DESTINATION bin) -endif(WIN32) diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/commands.c --- a/misc/openalbridge/commands.c Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* - * commands.c - * Hedgewars - * - * Created by Vittorio on 13/06/10. - * Copyright 2010 __MyCompanyName__. All rights reserved. - * - */ - -#include "commands.h" -#include "wrappers.h" - -ALfloat old_gain; -extern ALuint *Sources; -extern ALuint cache_size, cache_index, sources_number; -extern ALboolean instances_number; -extern al_sound_t *the_sounds; - -void openal_pausesound (uint32_t index) { - if (openal_ready() == AL_TRUE && index < cache_size) - alSourcePause(Sources[the_sounds[index].source_index]); -} - - -void openal_stopsound (uint32_t index) { - if (openal_ready() == AL_TRUE && index < cache_size) - alSourceStop(Sources[the_sounds[index].source_index]); -} - - -void openal_playsound (unsigned int index) { - ALboolean needsSource = AL_TRUE; - ALfloat SourcePosition[] = { 0.0, 0.0, 0.0 }; - ALfloat SourceVelocity[] = { 0.0, 0.0, 0.0 }; - ALint state; - int i, j; - - if (openal_ready() == AL_TRUE && index < cache_size) { - // check if sound has already a source - if (the_sounds[index].source_index != -1) { - // it has a source, check it's not playing - alGetSourcei(Sources[the_sounds[index].source_index], AL_SOURCE_STATE, &state); - if (state != AL_PLAYING && state != AL_PAUSED) { - // it is not being played, so we can use it safely - needsSource = AL_FALSE; - } - // else it is being played, so we have to allocate a new source for this buffer - } - - if (needsSource) { -#ifdef DEBUG - fprintf(stderr,"(Bridge Debug) - looking for a source for sound %d\n", index); -#endif - for (i = 0; i < sources_number; i++) { - // let's iterate on Sources until we find a source that is not playing - alGetSourcei(Sources[i], AL_SOURCE_STATE, &state); - if (state != AL_PLAYING && state != AL_PAUSED) { - // let's iterate on the_sounds until we find the sound using that source - for (j = 0; j < cache_size; j++) { - if (the_sounds[j].source_index == i) { - the_sounds[j].source_index = -1; - break; - } - } - // here we know that no-one is using that source so we can use it - break; - } - } - - if (i == sources_number) { - // this means all sources are busy - } - - // set source properties that it will use when it's in playback - alSourcei (Sources[i], AL_BUFFER, the_sounds[index].buffer); - alSourcef (Sources[i], AL_PITCH, 1.0f); - alSourcef (Sources[i], AL_GAIN, 1.0f); - alSourcefv(Sources[i], AL_POSITION, SourcePosition); - alSourcefv(Sources[i], AL_VELOCITY, SourceVelocity); - alSourcei (Sources[i], AL_LOOPING, 0); - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge ERROR) - failed to set Source properties\n"); - return; - } - the_sounds[index].source_index = i; - } - - alSourcePlay(Sources[the_sounds[index].source_index]); - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge Warning) - failed to play sound %d\n", index); - return; - } - - the_sounds[index].stats++; - } -} - -void openal_toggleloop (uint32_t index) { - ALint loop; - - if (openal_ready() == AL_TRUE && index < cache_size) { - alGetSourcei (Sources[the_sounds[index].source_index], AL_LOOPING, &loop); - alSourcei (Sources[the_sounds[index].source_index], AL_LOOPING, !((uint8_t) loop) & 0x00000001); - } -} - - -void openal_setvolume (uint32_t index, float gain) { - if (openal_ready() == AL_TRUE && index < cache_size) - alSourcef (Sources[the_sounds[index].source_index], AL_GAIN, gain); -} - - -void openal_setglobalvolume (float gain) { - if (openal_ready() == AL_TRUE) - alListenerf (AL_GAIN, gain); -} - -void openal_togglemute () { - ALfloat gain; - - if (openal_ready() == AL_TRUE) { - alGetListenerf (AL_GAIN, &gain); - if (gain > 0) { - old_gain = gain; - gain = 0; - } else - gain = old_gain; - - alListenerf (AL_GAIN, gain); - } -} - -// Fade in or out by calling a helper thread -void openal_fade (uint32_t index, uint16_t quantity, al_fade_t direction) { -#ifndef _WIN32 - pthread_t thread; -#else - HANDLE Thread; -#endif - fade_t *fade; - - if (openal_ready() == AL_TRUE && index < cache_size) { - fade = (fade_t*) Malloc(sizeof(fade_t)); - fade->index = index; - fade->quantity = quantity; - fade->type = direction; - -#ifndef _WIN32 - pthread_create(&thread, NULL, (void *)helper_fade, (void *)fade); - pthread_detach(thread); -#else - Thread = (HANDLE) _beginthread((void *)helper_fade, 0, (void *)fade); -#endif - } -} - -void openal_setposition (uint32_t index, float x, float y, float z) { - if (openal_ready() == AL_TRUE && index < cache_size) - alSource3f(Sources[the_sounds[index].source_index], AL_POSITION, x, y, z);; -} - -void helper_fade(void *tmp) { - ALfloat gain; - ALfloat target_gain; - fade_t *fade; - uint32_t index; - uint16_t quantity; - al_fade_t type; - - fade = tmp; - index = fade->index; - quantity = fade->quantity; - type = fade->type; - free (fade); - - if (type == AL_FADE_IN) { -#ifdef DEBUG - fprintf(stderr,"(Bridge Info) - Fade-in in progress [index %d quantity %d]", index, quantity); -#endif - - // save the volume desired after the fade - alGetSourcef(Sources[the_sounds[index].source_index], AL_GAIN, &target_gain); - if (target_gain > 1.0f || target_gain <= 0.0f) - target_gain = 1.0f; - - for (gain = 0.0f ; gain <= target_gain; gain += (float) quantity/10000) { -#ifdef TRACE - fprintf(stderr,"(Bridge Debug) - Fade-in set gain to %f\n", gain); -#endif - alSourcef(Sources[the_sounds[index].source_index], AL_GAIN, gain); - usleep(10000); - } - } else { - alGetSourcef(Sources[the_sounds[index].source_index], AL_GAIN, &target_gain); - - for (gain = target_gain; gain >= 0.00f; gain -= (float) quantity/10000) { -#ifdef TRACE - fprintf(stderr,"(Bridge Debug) - Fade-out set gain to %f\n", gain); -#endif - alSourcef(Sources[the_sounds[index].source_index], AL_GAIN, gain); - usleep(10000); - } - - if (AL_NO_ERROR != alGetError()) - fprintf(stderr,"(Bridge Warning) - Failed to set fade-out effect\n"); - - // stop that sound and reset its volume - alSourceStop (Sources[the_sounds[index].source_index]); - alSourcef (Sources[the_sounds[index].source_index], AL_GAIN, target_gain); - } - - if (AL_NO_ERROR != alGetError()) - fprintf(stderr,"(Bridge Warning) - Failed to set fade effect\n"); - -#ifndef _WIN32 - pthread_exit(NULL); -#else - _endthread(); -#endif -} - diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/commands.h --- a/misc/openalbridge/commands.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * commands.h - * Hedgewars - * - * Created by Vittorio on 13/06/10. - * Copyright 2010 __MyCompanyName__. All rights reserved. - * - */ - -#ifndef _OALB_COMMANDS_H -#define _OALB_COMMANDS_H - -#include "openalbridge_t.h" -#include "openalbridge.h" - - -#define openal_fadein(x,y) openal_fade(x,y,AL_FADE_IN) -#define openal_fadeout(x,y) openal_fade(x,y,AL_FADE_OUT) -#define openal_playsound_loop(x,y) openal_playsound(x) \ - if (y != 0) \ - openal_toggleloop(x); -#ifdef __CPLUSPLUS -extern "C" { -#endif - - // play, pause, stop a single sound source - void openal_pausesound (unsigned int index); - void openal_stopsound (unsigned int index); - - // play a sound and set whether it should loop or not (0/1) - void openal_playsound (unsigned int index); - - void openal_freesound (unsigned int index); - - // set or unset the looping property for a sound source - void openal_toggleloop (unsigned int index); - - // set position and volume of a sound source - void openal_setposition (unsigned int index, float x, float y, float z); - void openal_setvolume (unsigned int index, float gain); - - // set volume for all sounds (gain interval is [0-1]) - void openal_setglobalvolume (float gain); - - // mute or unmute all sounds - void openal_togglemute (void); - - // fade effect, - void openal_fade (unsigned int index, unsigned short int quantity, al_fade_t direction); - -#ifdef __CPLUSPLUS -} -#endif - -#endif /*_OALB_COMMANDS_H*/ \ No newline at end of file diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/globals.h --- a/misc/openalbridge/globals.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#ifndef _OALB_GLOBALS_H -#define _OALB_GLOBALS_H - -#include -#include -#include "al.h" - -#ifndef _WIN32 -#include -#include -#else -#include -#endif - - -// 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. [Wu Yongwei] -#ifndef _SLEEP_H -#define _SLEEP_H -#ifdef _WIN32 -# if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__)) -# include -# define sleep(t) _sleep((t) * 1000) -# else -# define WIN32_LEAN_AND_MEAN -# include -# define sleep(t) Sleep((t) * 1000) -# endif -# ifndef _NEED_SLEEP_ONLY -# define msleep(t) Sleep(t) -# define usleep(t) Sleep((t) / 1000) -# endif -#else -# include -# ifndef _NEED_SLEEP_ONLY -# define msleep(t) usleep((t) * 1000) -# endif -#endif -#endif // _SLEEP_H - - -// check compiler requirements -#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -#warning __BIG_ENDIAN__ or __LITTLE_ENDIAN__ not found, going to set __LITTLE_ENDIAN__ as default -#define __LITTLE_ENDIAN__ 1 -#endif - -/* use byteswap macros from the host system, hopefully optimized ones ;-) - * or define our own version, simple, stupid, straight-forward... */ -#ifdef HAVE_BYTESWAP_H -#include -#else -#define bswap_16(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) -#define bswap_32(x) (((x & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ - ((x & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) -#endif /* HAVE_BYTESWAP_H */ - -/* swap numbers accordingly to architecture automatically */ -#ifdef __LITTLE_ENDIAN__ -#define ENDIAN_LITTLE_32(x) x -#define ENDIAN_BIG_32(x) bswap_32(x) -#define ENDIAN_LITTLE_16(x) x -#define ENDIAN_BIG_16(x) bswap_16(x) -#elif __BIG_ENDIAN__ -#define ENDIAN_LITTLE_32(x) bswap_32(x) -#define ENDIAN_BIG_32(x) x -#define ENDIAN_LITTLE_16(x) bswap_16(x) -#define ENDIAN_BIG_16(x) x -#endif - -/* file format defines */ -#define OGG_FILE_FORMAT 0x4F676753 -#define WAV_FILE_FORMAT 0x52494646 -#define WAV_HEADER_SUBCHUNK2ID 0x64617461 - - -#endif /*_OALB_GLOBALS_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/loaders.c --- a/misc/openalbridge/loaders.c Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* OpenAL Bridge - a simple portable library for OpenAL interface -* Copyright (c) 2009 Vittorio Giovara -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser 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 -*/ - -#include "loaders.h" -#include "wrappers.h" -#include "vorbis/vorbisfile.h" -#include "openalbridge_t.h" - - -int load_wavpcm (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq) { - WAV_header_t WAVHeader; - FILE *wavfile; - int32_t t; - uint32_t n = 0; - uint8_t sub0, sub1, sub2, sub3; - - wavfile = Fopen(filename, "rb"); - - fread(&WAVHeader.ChunkID, sizeof(uint32_t), 1, wavfile); /*RIFF*/ - fread(&WAVHeader.ChunkSize, sizeof(uint32_t), 1, wavfile); - fread(&WAVHeader.Format, sizeof(uint32_t), 1, wavfile); /*WAVE*/ - -#ifdef DEBUG - fprintf(stderr, "ChunkID: %X\n", ENDIAN_BIG_32(WAVHeader.ChunkID)); - fprintf(stderr, "ChunkSize: %d\n", ENDIAN_LITTLE_32(WAVHeader.ChunkSize)); - fprintf(stderr, "Format: %X\n", ENDIAN_BIG_32(WAVHeader.Format)); -#endif - - fread(&WAVHeader.Subchunk1ID, sizeof(uint32_t), 1, wavfile); /*fmt */ - fread(&WAVHeader.Subchunk1Size, sizeof(uint32_t), 1, wavfile); - fread(&WAVHeader.AudioFormat, sizeof(uint16_t), 1, wavfile); - fread(&WAVHeader.NumChannels, sizeof(uint16_t), 1, wavfile); - fread(&WAVHeader.SampleRate, sizeof(uint32_t), 1, wavfile); - fread(&WAVHeader.ByteRate, sizeof(uint32_t), 1, wavfile); - fread(&WAVHeader.BlockAlign, sizeof(uint16_t), 1, wavfile); - fread(&WAVHeader.BitsPerSample, sizeof(uint16_t), 1, wavfile); - -#ifdef DEBUG - fprintf(stderr, "Subchunk1ID: %X\n", ENDIAN_BIG_32(WAVHeader.Subchunk1ID)); - fprintf(stderr, "Subchunk1Size: %d\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk1Size)); - fprintf(stderr, "AudioFormat: %d\n", ENDIAN_LITTLE_16(WAVHeader.AudioFormat)); - fprintf(stderr, "NumChannels: %d\n", ENDIAN_LITTLE_16(WAVHeader.NumChannels)); - fprintf(stderr, "SampleRate: %d\n", ENDIAN_LITTLE_32(WAVHeader.SampleRate)); - fprintf(stderr, "ByteRate: %d\n", ENDIAN_LITTLE_32(WAVHeader.ByteRate)); - fprintf(stderr, "BlockAlign: %d\n", ENDIAN_LITTLE_16(WAVHeader.BlockAlign)); - fprintf(stderr, "BitsPerSample: %d\n", ENDIAN_LITTLE_16(WAVHeader.BitsPerSample)); -#endif - - /*remove useless header chunks by looking for the WAV_HEADER_SUBCHUNK2ID integer */ - do { - t = fread(&sub0, sizeof(uint8_t), 1, wavfile); - if(sub0 == 0x64) { - t = fread(&sub1, sizeof(uint8_t), 1, wavfile); - if(sub1 == 0x61) { - t = fread(&sub2, sizeof(uint8_t), 1, wavfile); - if(sub2 == 0x74) { - t = fread(&sub3, sizeof(uint8_t), 1, wavfile); - if(sub3 == 0x61) { - WAVHeader.Subchunk2ID = WAV_HEADER_SUBCHUNK2ID; - break; - } - } - } - } - - if (t <= 0) { - // eof - fprintf(stderr,"(Bridge Error) - wrong WAV header\n"); - return -1; - } - } while (1); - - fread(&WAVHeader.Subchunk2Size, sizeof(uint32_t), 1, wavfile); - -#ifdef DEBUG - fprintf(stderr, "Subchunk2ID: %X\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk2ID)); - fprintf(stderr, "Subchunk2Size: %d\n", ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); -#endif - - *data = (char*) Malloc (sizeof(char) * ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); - - /*read the actual sound data*/ - do { - n += fread(&((*data)[n]), sizeof(uint8_t), 4, wavfile); - } while (n < ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size)); - - fclose(wavfile); - -#ifdef DEBUG - fprintf(stderr,"(Bridge Info) - WAV data loaded\n"); -#endif - - /*set parameters for OpenAL*/ - /*Valid formats are AL_FORMAT_MONO8, AL_FORMAT_MONO16, AL_FORMAT_STEREO8, and AL_FORMAT_STEREO16*/ - if (ENDIAN_LITTLE_16(WAVHeader.NumChannels) == 1) { - if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 8) - *format = AL_FORMAT_MONO8; - else { - if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16) - *format = AL_FORMAT_MONO16; - else { - fprintf(stderr,"(Bridge Error) - wrong WAV header [bitsample value]\n"); - return -2; - } - } - } else { - if (ENDIAN_LITTLE_16(WAVHeader.NumChannels) == 2) { - if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 8) - *format = AL_FORMAT_STEREO8; - else { - if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16) - *format = AL_FORMAT_STEREO16; - else { - fprintf(stderr,"(Bridge Error) - wrong WAV header [bitsample value]\n"); - return -2; - } - } - } else { - fprintf(stderr,"(Bridge Error) - wrong WAV header [format value]\n"); - return -2; - } - } - - *bitsize = ENDIAN_LITTLE_32(WAVHeader.Subchunk2Size); - *freq = ENDIAN_LITTLE_32(WAVHeader.SampleRate); - return 0; -} - - -int load_oggvorbis (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq) { - /*implementation inspired from http://www.devmaster.net/forums/showthread.php?t=1153 */ - - /*ogg handle*/ - FILE *oggFile; - /*stream handle*/ - OggVorbis_File oggStream; - /*some formatting data*/ - vorbis_info *vorbisInfo; - /*length of the decoded data*/ - int64_t pcm_length; - /*other vars*/ - int section, result, size, endianness; -#ifdef DEBUG - int i; - /*other less useful data*/ - vorbis_comment *vorbisComment; -#endif - - oggFile = Fopen(filename, "rb"); - result = ov_open_callbacks(oggFile, &oggStream, NULL, 0, OV_CALLBACKS_DEFAULT); - if (result < 0) { - fprintf(stderr,"(Bridge Error) - ov_open_callbacks() failed with %X\n", result); - ov_clear(&oggStream); - return -1; - } - - /*load OGG header and determine the decoded data size*/ - vorbisInfo = ov_info(&oggStream, -1); - pcm_length = ov_pcm_total(&oggStream, -1) << vorbisInfo->channels; - -#ifdef DEBUG - vorbisComment = ov_comment(&oggStream, -1); - fprintf(stderr, "Version: %d\n", vorbisInfo->version); - fprintf(stderr, "Channels: %d\n", vorbisInfo->channels); - fprintf(stderr, "Rate (Hz): %ld\n", vorbisInfo->rate); - fprintf(stderr, "Bitrate Upper: %ld\n", vorbisInfo->bitrate_upper); - fprintf(stderr, "Bitrate Nominal: %ld\n", vorbisInfo->bitrate_nominal); - fprintf(stderr, "Bitrate Lower: %ld\n", vorbisInfo->bitrate_lower); - fprintf(stderr, "Bitrate Windows: %ld\n", vorbisInfo->bitrate_window); - fprintf(stderr, "Vendor: %s\n", vorbisComment->vendor); - fprintf(stderr, "PCM data size: %lld\n", pcm_length); - fprintf(stderr, "# comment: %d\n", vorbisComment->comments); - for (i = 0; i < vorbisComment->comments; i++) - fprintf(stderr, "\tComment %d: %s\n", i, vorbisComment->user_comments[i]); -#endif - - /*allocates enough room for the decoded data*/ - *data = (char*) Malloc (sizeof(char) * pcm_length); - - /*there *should* not be ogg at 8 bits*/ - if (vorbisInfo->channels == 1) - *format = AL_FORMAT_MONO16; - else { - if (vorbisInfo->channels == 2) - *format = AL_FORMAT_STEREO16; - else { - fprintf(stderr,"(Bridge Error) - wrong OGG header [channel %d]\n", vorbisInfo->channels); - ov_clear(&oggStream); - return -2; - } - } - - size = 0; -#ifdef __LITTLE_ENDIAN__ - endianness = 0; -#elif __BIG_ENDIAN__ - endianness = 1; -#endif - while (size < pcm_length) { - /*ov_read decodes the ogg stream and storse the pcm in data*/ - result = ov_read (&oggStream, *data + size, pcm_length - size, endianness, 2, 1, §ion); - if (result > 0) { - size += result; - } else { - if (result == 0) - break; - else { - fprintf(stderr,"(Bridge Error) - End of file from OGG stream\n"); - ov_clear(&oggStream); - return -3; - } - } - } - - /*set the last fields*/ - *bitsize = size; - *freq = vorbisInfo->rate; - - /*cleaning time (ov_clear also closes file handler)*/ - ov_clear(&oggStream); - - return 0; -} diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/loaders.h --- a/misc/openalbridge/loaders.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#include "globals.h" - -#ifndef _OALB_LOADERS_H -#define _OALB_LOADERS_H - -int load_wavpcm (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq); -int load_oggvorbis (const char *filename, ALenum *format, char **data, ALsizei *bitsize, ALsizei *freq); - -#endif /*_OALB_LOADERS_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/openalbridge.c --- a/misc/openalbridge/openalbridge.c Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,265 +0,0 @@ -/* -* OpenAL Bridge - a simple portable library for OpenAL interface -* Copyright (c) 2009 Vittorio Giovara -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser 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 -*/ - -#include "openalbridge.h" -#include "globals.h" -#include "al.h" -#include "alc.h" -#include "wrappers.h" -#include "loaders.h" -#include "string.h" - -// Sources are points emitting sound, their number is limited, but a single source can play many buffers -// Buffers hold sound data and are unlimited -ALuint *Sources; -ALuint cache_size, cache_index, sources_number; -ALboolean instances_number; -al_sound_t *the_sounds; -ALint cache_pointer; - -// Initialize an OpenAL contex and allocate memory space for data and buffers -// It can be called twice to increase the cache size -int openal_init (int memorysize) { - ALCcontext *context; - ALCdevice *device; - int i; - - // reuse old context and resize the existing - if (openal_ready() == AL_TRUE) { - cache_size += memorysize; - fprintf(stderr,"(Bridge Info) - already initialized, resizing cache to %d\n", cache_size); - the_sounds = (al_sound_t *)Realloc (the_sounds, sizeof(al_sound_t) * cache_size); - for (i = cache_size - memorysize; i < cache_size; i++) { - the_sounds[i].filename = NULL; - the_sounds[i].buffer = -1; - the_sounds[i].source_index = -1; - the_sounds[i].stats = 0; - } - instances_number++; - return AL_TRUE; - } - - cache_pointer = 0; - instances_number++; - - // set the memory dimentsion and the increment width when reallocating - if (memorysize <= 0) - cache_size = 50; - else - cache_size = memorysize; - - // open hardware device if present - device = alcOpenDevice(NULL); - sources_number = 16; - if (device == NULL) { - fprintf(stderr,"(Bridge Warning) - failed to open sound device, using software renderer\n"); - device = alcOpenDevice("Generic Software"); - sources_number = 32; - if (device == NULL) { - fprintf(stderr,"(Bridge ERROR) - failed to start software renderer, sound will be disabled\n"); - return -1; - } - } - - fprintf(stderr,"(Bridge Info) - output device: %s\n", alcGetString(device, ALC_DEVICE_SPECIFIER)); - - context = alcCreateContext(device, NULL); - alcMakeContextCurrent(context); - alcProcessContext(context); - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge ERROR) - Failed to create a new contex\n"); - alcMakeContextCurrent(NULL); - alcDestroyContext(context); - alcCloseDevice(device); - return -2; - } - - Sources = (ALuint *)Malloc (sizeof(ALuint) * sources_number); - alGenSources(sources_number, Sources); - - // set the listener gain, position (on xyz axes), velocity (one value for each axe) and orientation - // Position, Velocity and Orientation of the listener - ALfloat ListenerPos[] = {0.0, 0.0, 0.0}; - ALfloat ListenerVel[] = {0.0, 0.0, 0.0}; - ALfloat ListenerOri[] = {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}; - - alListenerf (AL_GAIN, 1.0f ); - alListenerfv(AL_POSITION, ListenerPos); - alListenerfv(AL_VELOCITY, ListenerVel); - alListenerfv(AL_ORIENTATION, ListenerOri); - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge ERROR) - Failed to set Listener properties\n"); - return -3; - } - - the_sounds = (al_sound_t *)Malloc (sizeof(al_sound_t) * cache_size); - for (i = 0; i < cache_size; i++) { - the_sounds[i].filename = NULL; - the_sounds[i].buffer = -1; - the_sounds[i].source_index = -1; - the_sounds[i].stats = 0; - } - - alGetError(); - return AL_TRUE; -} - - -// Stop all sounds, deallocate all memory and close OpenAL context -void openal_close (void) { - ALCcontext *context; - ALCdevice *device; - int i; - - if (instances_number == 0) { - fprintf(stderr,"(Bridge Warning) - OpenAL not initialized\n"); - return; - } - - instances_number--; - if (instances_number > 0) { - return; - } - - //TODO: free other stuff also - for (i = 0; i < cache_size; i++) - alDeleteBuffers (1, &the_sounds[i].buffer); - free(the_sounds); - - alSourceStopv (sources_number, Sources); - alDeleteSources (sources_number, Sources); - - free(Sources); - - context = alcGetCurrentContext(); - device = alcGetContextsDevice(context); - - alcMakeContextCurrent(NULL); - alcDestroyContext(context); - alcCloseDevice(device); - - fprintf(stderr,"(Bridge Info) - closed\n"); - - return; -} - - -ALboolean openal_ready (void) { - if (instances_number >= 1) - return AL_TRUE; - else - return AL_FALSE; -} - - -// Open a file, load into memory and allocate the Source buffer for playing -int openal_loadfile (const char *filename){ - ALenum format, error; - ALsizei bitsize, freq; - uint32_t fileformat; - al_sound_t soundData; - int len, i; - char *data; - FILE *fp; - - if (openal_ready() == AL_FALSE) { - fprintf(stderr,"(Bridge Warning) - not initialized\n"); - return -1; - } - - // if this sound is already loaded return the index from the_sounds - len = strlen(filename); - for (i = 0; i < cache_size; i++) { - if (the_sounds[i].filename != NULL && strncmp(the_sounds[i].filename, filename, len) == 0) { -#ifdef DEBUG - fprintf(stderr,"(Bridge Debug) - sound %d is already loaded\n", i); -#endif - return i; - } - } - - if (cache_pointer >= cache_size) { - fprintf(stderr,"(Bridge ERROR) - Cache size limit reached; consider allocating more space\n", filename); - return -2; - } - - // detect the file format, as written in the first 4 bytes of the header - fp = Fopen (filename, "rb"); - - if (fp == NULL) { - fprintf(stderr,"(Bridge ERROR) - File %s not loaded\n", filename); - return -3; - } - - error = fread (&fileformat, sizeof(uint32_t), 1, fp); - fclose (fp); - - if (error < 0) { - fprintf(stderr,"(Bridge ERROR) - File %s is too short\n", filename); - return -4; - } - - switch (ENDIAN_BIG_32(fileformat)) { - case OGG_FILE_FORMAT: - error = load_oggvorbis (filename, &format, &data, &bitsize, &freq); - break; - case WAV_FILE_FORMAT: - error = load_wavpcm (filename, &format, &data, &bitsize, &freq); - break; - default: - fprintf(stderr,"(Bridge ERROR) - File format (%08X) not supported\n", ENDIAN_BIG_32(fileformat)); - return -5; - break; - } - - if (error != 0) { - fprintf(stderr,"(Bridge ERROR) - error loading file %s\n", filename); - free(data); - return -6; - } - - alGenBuffers(1, &soundData.buffer); - soundData.filename = filename; - soundData.source_index = -1; - soundData.stats = 0; - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge ERROR) - Failed to allocate memory for buffers\n"); - return -5; - } - - // copy pcm data in one buffer and free it - alBufferData(soundData.buffer, format, data, bitsize, freq); - free(data); - - if (AL_NO_ERROR != alGetError()) { - fprintf(stderr,"(Bridge ERROR) - Failed to write data to buffers\n"); - return -8; - } - - // clear any AL errors beforehand - alGetError(); - - fprintf(stderr,"(Bridge Info) - successfully loaded %s\n", filename); - - // returns the index of the source you just loaded, increments it and exits - the_sounds[cache_pointer] = soundData; - return cache_pointer++; -} diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/openalbridge.def --- a/misc/openalbridge/openalbridge.def Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -LIBRARY "openalbridge" -EXPORTS - openal_init - openal_close - openal_ready - openal_loadfile - openal_playsound - openal_pausesound - openal_stopsound - openal_playsound_loop - openal_stopsound_free - openal_freesound - openal_toggleloop - openal_setvolume - openal_setglobalvolume - openal_togglemute - openal_fade - openal_fadein - openal_fadeout - diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/openalbridge.h --- a/misc/openalbridge/openalbridge.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#ifndef _OALB_INTERFACE_H -#define _OALB_INTERFACE_H - -#include "openalbridge_t.h" -#include "commands.h" - -#ifdef __CPLUSPLUS -extern "C" { -#endif - - // init audio context and allocate memory - int openal_init (int memorysize); - - // close audio subsytem and free memory - void openal_close (void); - - // check if openal_init has been called - char openal_ready (void); - - // load an audio file into memory and map it to abuffer - int openal_loadfile (const char *filename); - - - /******* other functions continue in commands.h *******/ - -#ifdef __CPLUSPLUS -} -#endif - -#endif /*_OALB_INTERFACE_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/openalbridge_t.h --- a/misc/openalbridge/openalbridge_t.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#include -#include "al.h" - -#ifndef _OALB_INTERFACE_TYPES_H -#define _OALB_INTERFACE_TYPES_H - -enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT}; -typedef enum al_fade_enum al_fade_t; - - -// data type to handle which source source is playing what -#pragma pack(1) -typedef struct _al_sound_t { - const char *filename; // name of the sound file - ALuint buffer; // actual sound content - uint32_t source_index; // index of the associated source - uint32_t stats; // number of times the sound has been played -} al_sound_t; -#pragma pack() - - -// data type for passing data between threads -#pragma pack(1) -typedef struct _fade_t { - uint32_t index; - uint16_t quantity; - al_fade_t type; -} fade_t; -#pragma pack() - - -// data type for WAV header -#pragma pack(1) -typedef struct _WAV_header_t { - uint32_t ChunkID; - uint32_t ChunkSize; - uint32_t Format; - uint32_t Subchunk1ID; - uint32_t Subchunk1Size; - uint16_t AudioFormat; - uint16_t NumChannels; - uint32_t SampleRate; - uint32_t ByteRate; - uint16_t BlockAlign; - uint16_t BitsPerSample; - uint32_t Subchunk2ID; - uint32_t Subchunk2Size; -} WAV_header_t; -#pragma pack() - - -#ifdef __CPLUSPLUS -} -#endif - -#endif /*_OALB_INTERFACE_TYPES_H*/ diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/wrappers.c --- a/misc/openalbridge/wrappers.c Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* OpenAL Bridge - a simple portable library for OpenAL interface -* Copyright (c) 2009 Vittorio Giovara -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser 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 -*/ - -#include "wrappers.h" -#include "openalbridge_t.h" - - -void *Malloc (size_t nbytes) { - void *aptr; - - if ((aptr = malloc(nbytes)) == NULL) { - fprintf(stderr,"(Bridge FATAL) - not enough memory\n"); - abort(); - } - - return aptr; -} - - -void *Realloc (void *aptr, size_t nbytes) { - aptr = realloc(aptr, nbytes); - - if (aptr == NULL) { - fprintf(stderr,"(Bridge FATAL) - not enough memory\n"); - abort(); - } - - return aptr; -} - - -FILE *Fopen (const char *fname, char *mode) { - FILE *fp; - - fp = fopen(fname,mode); - if (fp == NULL) - fprintf(stderr,"(Bridge Error) - can't open file %s in mode '%s'\n", fname, mode); - - return fp; -} - - diff -r f589230fa21b -r 59dbd31e9953 misc/openalbridge/wrappers.h --- a/misc/openalbridge/wrappers.h Thu Jun 17 19:57:51 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#ifndef _OALB_WRAPPERS_H -#define _OALB_WRAPPERS_H - -#include "globals.h" -#include "openalbridge_t.h" - -void *Malloc (size_t nbytes); -void *Realloc (void *aptr, size_t nbytes); -FILE *Fopen (const char *fname, char *mode); -void helper_fade (void *tmp); - -#endif /*_OALB_WRAPPERS_H*/ diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/DetailViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/DetailViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,36 @@ +// +// DetailViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class GeneralSettingsViewController; +@class TeamSettingsViewController; +@class WeaponSettingsViewController; +@class SchemeSettingsViewController; + +@interface DetailViewController : UITableViewController +#if __IPHONE_3_2 + +#endif +{ + NSArray *controllerNames; + + GeneralSettingsViewController *generalSettingsViewController; + TeamSettingsViewController *teamSettingsViewController; + WeaponSettingsViewController *weaponSettingsViewController; + SchemeSettingsViewController *schemeSettingsViewController; + UIPopoverController *popoverController; +} + +// used in iphone version +-(IBAction) dismissSplitView; + +@property (nonatomic, retain) NSArray *controllerNames; +@property (nonatomic,retain) UIPopoverController *popoverController; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/DetailViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/DetailViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,208 @@ + // +// DetailViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "DetailViewController.h" +#import "SDL_uikitappdelegate.h" +#import "GeneralSettingsViewController.h" +#import "TeamSettingsViewController.h" +#import "WeaponSettingsViewController.h" +#import "SchemeSettingsViewController.h" +#import "CommodityFunctions.h" + +@implementation DetailViewController +@synthesize controllerNames,popoverController; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ + self.view.frame = CGRectMake(0, 0, 1024, 1024); +} + +-(void) viewDidLoad { + self.title = NSLocalizedString(@"Settings",@""); + + // allocate controllers and store them into the array + NSArray *array= [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), + NSLocalizedString(@"Teams",@""), + NSLocalizedString(@"Weapons",@""), + NSLocalizedString(@"Schemes",@""), + nil]; + self.controllerNames = array; + [array release]; + + // on ipad make the general setting the first view, on iphone add the "Done" button on top left + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(112, 112, 480, 320)]; + label.text = @"Press the buttons on the left"; + label.font = [UIFont systemFontOfSize:20]; + label.textAlignment = UITextAlignmentCenter; + [self.view addSubview:label]; + [label release]; + + //[self.navigationController pushViewController:nextController animated:NO]; + } else { + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + target:self + action:@selector(dismissSplitView)]; + } + + [super viewDidLoad]; +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + // don't display + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + return 0; + else + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [controllerNames count]; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier] autorelease]; + } + + NSInteger row = [indexPath row]; + + cell.textLabel.text = [controllerNames objectAtIndex:row]; + cell.imageView.image = [UIImage imageNamed:@"Icon.png"]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + return cell; +} + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSInteger row = [indexPath row]; + UIViewController *nextController = nil; + + switch (row) { + case 0: + if (nil == generalSettingsViewController) + generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = generalSettingsViewController; + break; + case 1: + if (nil == teamSettingsViewController) + teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = teamSettingsViewController; + break; + case 2: + if (nil == weaponSettingsViewController) + weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = weaponSettingsViewController; + break; + case 3: + if (nil == schemeSettingsViewController) + schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = schemeSettingsViewController; + break; + } + + nextController.title = [controllerNames objectAtIndex:row]; + [self.navigationController pushViewController:nextController animated:YES]; +} + +-(IBAction) dismissSplitView { + [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; +} + +#if __IPHONE_3_2 +#pragma mark - +#pragma mark splitview support +-(void) splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController { + if (popoverController != nil) { + [popoverController dismissPopoverAnimated:YES]; + } +} + +// Called when the master view controller is about to be hidden +-(void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController + withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc { + + /* barButtonItem.title = @"Master View"; + UIToolbar *toolbar = self.parentViewController.navigationController.toolbar; + NSMutableArray *items = [[toolbar items] mutableCopy]; + [items insertObject:barButtonItem atIndex:0]; + [toolbar setItems:items animated:YES]; + + [items release]; + + self.popoverController = pc;*/ + barButtonItem.title = aViewController.title; + self.navigationItem.rightBarButtonItem = barButtonItem; +} + +// Called when the master view controller is about to appear +-(void) splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController + invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem { + /*UIToolbar *toolbar = self.parentViewController.navigationController.toolbar; + + NSMutableArray *items = [[toolbar items] mutableCopy]; + [items removeObjectAtIndex:0]; + + [toolbar setItems:items animated:YES]; + + [items release]; + + self.popoverController = nil;*/ + self.navigationItem.rightBarButtonItem = nil; + +} +#endif + +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Release any cached data, images, etc that aren't in use. + if (generalSettingsViewController.view.superview == nil) + generalSettingsViewController = nil; + if (teamSettingsViewController.view.superview == nil) + teamSettingsViewController = nil; + if (weaponSettingsViewController.view.superview == nil) + weaponSettingsViewController = nil; + if (schemeSettingsViewController.view.superview == nil) + schemeSettingsViewController = nil; + MSG_MEMCLEAN(); +} + +-(void) viewDidUnload { + self.controllerNames = nil; + generalSettingsViewController = nil; + teamSettingsViewController = nil; + weaponSettingsViewController = nil; + schemeSettingsViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [controllerNames release]; + [generalSettingsViewController release]; + [teamSettingsViewController release]; + [weaponSettingsViewController release]; + [schemeSettingsViewController release]; + [super dealloc]; +} +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/FlagsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,23 @@ +// +// FlagsViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface FlagsViewController : UITableViewController { + NSDictionary *teamDictionary; + + NSArray *flagArray; + NSIndexPath *lastIndexPath; +} + +@property (nonatomic,retain) NSDictionary * teamDictionary; +@property (nonatomic,retain) NSArray *flagArray; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/FlagsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,126 @@ +// +// FlagsViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "FlagsViewController.h" +#import "CommodityFunctions.h" + +@implementation FlagsViewController +@synthesize teamDictionary, flagArray, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + self.flagArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL]; +} + +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.tableView reloadData]; + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [flagArray count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + NSString *flag = [flagArray objectAtIndex:[indexPath row]]; + + NSString *flagFile = [[NSString alloc] initWithFormat:@"%@/%@", FLAGS_DIRECTORY(), flag]; + UIImage *flagSprite = [[UIImage alloc] initWithContentsOfFile:flagFile]; + [flagFile release]; + cell.imageView.image = flagSprite; + [flagSprite release]; + + cell.textLabel.text = [flag stringByDeletingPathExtension]; + if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"flag"]]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + // if the two selected rows differ update data on the hog dictionary and reload table content + [self.teamDictionary setValue:[[flagArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"flag"]; + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + self.lastIndexPath = indexPath; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.navigationController popViewControllerAnimated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.teamDictionary = nil; + self.lastIndexPath = nil; + self.flagArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [teamDictionary release]; + [lastIndexPath release]; + [flagArray release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/FortsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/FortsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,23 @@ +// +// FortsViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface FortsViewController : UITableViewController { + NSDictionary *teamDictionary; + + NSArray *fortArray; + NSIndexPath *lastIndexPath; +} + +@property (nonatomic,retain) NSDictionary * teamDictionary; +@property (nonatomic,retain) NSArray *fortArray; +//@property (nonatomic,retain) NSArray *fortSprites; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/FortsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/FortsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,161 @@ +// +// FortsViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "FortsViewController.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation FortsViewController +@synthesize teamDictionary, fortArray, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FORTS_DIRECTORY() error:NULL]; + NSMutableArray *filteredContents = [[NSMutableArray alloc] initWithCapacity:([directoryContents count] / 2)]; + // we need to remove the double entries and the L.png suffix + for (int i = 0; i < [directoryContents count]; i++) { + if (i % 2) { + NSString *currentName = [directoryContents objectAtIndex:i]; + NSString *correctName = [currentName substringToIndex:([currentName length] - 5)]; + [filteredContents addObject:correctName]; + } + } + self.fortArray = filteredContents; + [filteredContents release]; + + /* + // this creates a scaled down version of the image + NSMutableArray *spriteArray = [[NSMutableArray alloc] initWithCapacity:[fortArray count]]; + for (NSString *fortName in fortArray) { + NSString *fortFile = [[NSString alloc] initWithFormat:@"%@/%@L.png", fortsDirectory, fortName]; + UIImage *fortSprite = [[UIImage alloc] initWithContentsOfFile:fortFile]; + [fortFile release]; + [spriteArray addObject:[fortSprite scaleToSize:CGSizeMake(196,196)]]; + [fortSprite release]; + } + self.fortSprites = spriteArray; + [spriteArray release]; + */ + + // statically set row height instead of using delegate method for performance reasons + self.tableView.rowHeight = 200; +} + + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.tableView reloadData]; + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.fortArray count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle + reuseIdentifier:CellIdentifier] autorelease]; + } + + NSString *fortName = [fortArray objectAtIndex:[indexPath row]]; + cell.textLabel.text = fortName; + + // this creates a scaled down version of the image + // TODO: create preview files, scaling is way too slow! + NSString *fortFile = [[NSString alloc] initWithFormat:@"%@/%@L.png", FORTS_DIRECTORY(), fortName]; + UIImage *fortSprite = [[UIImage alloc] initWithContentsOfFile:fortFile]; + [fortFile release]; + cell.imageView.image = [fortSprite scaleToSize:CGSizeMake(196,196)]; + [fortSprite release]; + + cell.detailTextLabel.text = @"Insert funny description here"; + if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"fort"]]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + // if the two selected rows differ update data on the hog dictionary and reload table content + [self.teamDictionary setValue:[fortArray objectAtIndex:newRow] forKey:@"fort"]; + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + self.lastIndexPath = indexPath; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.navigationController popViewControllerAnimated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.teamDictionary = nil; + self.lastIndexPath = nil; + self.fortArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + + +- (void)dealloc { + [teamDictionary release]; + [lastIndexPath release]; + [fortArray release]; +// [fortSprites release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,26 @@ +// +// GameConfigViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 18/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class TeamConfigViewController; +@class MapConfigViewController; +@class SchemeWeaponConfigViewController; + +@interface GameConfigViewController : UIViewController { + UIViewController *activeController; + MapConfigViewController *mapConfigViewController; + TeamConfigViewController *teamConfigViewController; + SchemeWeaponConfigViewController *schemeWeaponConfigViewController; +} + +-(IBAction) buttonPressed:(id) sender; +-(IBAction) segmentPressed:(id) sender; +-(void) startGame; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,200 @@ + // +// GameConfigViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 18/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "GameConfigViewController.h" +#import "SDL_uikitappdelegate.h" +#import "CommodityFunctions.h" +#import "MapConfigViewController.h" +#import "TeamConfigViewController.h" +#import "SchemeWeaponConfigViewController.h" + +@implementation GameConfigViewController + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +-(IBAction) buttonPressed:(id) sender { + // works even if it's not actually a button + UIButton *theButton = (UIButton *)sender; + switch (theButton.tag) { + case 0: + [[self parentViewController] dismissModalViewControllerAnimated:YES]; + break; + case 1: + [self performSelector:@selector(startGame) + withObject:nil + afterDelay:0.25]; + break; + default: + break; + } +} + +-(IBAction) segmentPressed:(id) sender { + UISegmentedControl *theSegment = (UISegmentedControl *)sender; + + switch (theSegment.selectedSegmentIndex) { + case 0: + // this init here is just aestetic as this controller was already set up in viewDidLoad + if (mapConfigViewController == nil) { + mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; + } + activeController = mapConfigViewController; + break; + case 1: + if (teamConfigViewController == nil) { + teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; + // this message is compulsory otherwise the table won't be loaded at all + } + activeController = teamConfigViewController; + break; + case 2: + if (schemeWeaponConfigViewController == nil) { + schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; + } + activeController = schemeWeaponConfigViewController; + break; + } + + // this message is compulsory otherwise the table won't be loaded at all + [activeController viewWillAppear:NO]; + [self.view addSubview:activeController.view]; +} + +-(void) startGame { + // don't start playing if the preview is in progress + if ([mapConfigViewController busy]) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"") + message:NSLocalizedString(@"Before playing the preview needs to be generated",@"") + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") + otherButtonTitles:nil]; + [alert show]; + [alert release]; + return; + } + + // play only if there is more than one team + if ([teamConfigViewController.listOfSelectedTeams count] < 2) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"") + message:NSLocalizedString(@"You need to select at least two teams to play a game",@"") + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") + otherButtonTitles:nil]; + [alert show]; + [alert release]; + return; + } + + // play if there's room for enough hogs in the selected map + int hogs = 0; + for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams) + hogs += [[teamData objectForKey:@"number"] intValue]; + + if (hogs > mapConfigViewController.maxHogs) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"") + message:NSLocalizedString(@"The map you selected is too small for that many hogs",@"") + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") + otherButtonTitles:nil]; + [alert show]; + [alert release]; + return; + } + + // create the configuration file that is going to be sent to engine + NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command", + mapConfigViewController.templateFilterCommand,@"templatefilter_command", + mapConfigViewController.mapGenCommand,@"mapgen_command", + mapConfigViewController.mazeSizeCommand,@"mazesize_command", + mapConfigViewController.themeCommand,@"theme_command", + teamConfigViewController.listOfSelectedTeams,@"teams_list", + schemeWeaponConfigViewController.selectedScheme,@"scheme", + schemeWeaponConfigViewController.selectedWeapon,@"weapon", + nil]; + [dict writeToFile:GAMECONFIG_FILE() atomically:YES]; + [dict release]; + + // finally launch game and remove this controller + [[self parentViewController] dismissModalViewControllerAnimated:YES]; + [[SDLUIKitDelegate sharedAppDelegate] startSDLgame]; +} + +-(void) viewDidLoad { + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + if (mapConfigViewController == nil) + mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; + if (teamConfigViewController == nil) + teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStylePlain]; + teamConfigViewController.view.frame = CGRectMake(0, 224, 300, 500); + teamConfigViewController.view.backgroundColor = [UIColor clearColor]; + [mapConfigViewController.view addSubview:teamConfigViewController.view]; + if (schemeWeaponConfigViewController == nil) + schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; + schemeWeaponConfigViewController.view.frame = CGRectMake(362, 224, 300, 500); + schemeWeaponConfigViewController.view.backgroundColor = [UIColor clearColor]; + [mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; + } else + mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; + activeController = mapConfigViewController; + + [self.view addSubview:mapConfigViewController.view]; + + [super viewDidLoad]; +} + +-(void) viewWillAppear:(BOOL)animated { + [mapConfigViewController viewWillAppear:animated]; + [teamConfigViewController viewWillAppear:animated]; + [schemeWeaponConfigViewController viewWillAppear:animated]; + // ADD other controllers here + + [super viewWillAppear:animated]; +} + +-(void) viewDidAppear:(BOOL)animated { + [mapConfigViewController viewDidAppear:animated]; + [teamConfigViewController viewDidAppear:animated]; + [schemeWeaponConfigViewController viewDidAppear:animated]; + [super viewDidAppear:animated]; +} + +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Release any cached data, images, etc that aren't in use. + if (mapConfigViewController.view.superview == nil) + mapConfigViewController = nil; + if (teamConfigViewController.view.superview == nil) + teamConfigViewController = nil; + if (schemeWeaponConfigViewController.view.superview == nil) + schemeWeaponConfigViewController = nil; + activeController = nil; + MSG_MEMCLEAN(); +} + +-(void) viewDidUnload { + activeController = nil; + mapConfigViewController = nil; + teamConfigViewController = nil; + schemeWeaponConfigViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [activeController release]; + [mapConfigViewController release]; + [teamConfigViewController release]; + [schemeWeaponConfigViewController release]; + [super dealloc]; +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GameSetup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,32 @@ +// +// gameSetup.h +// hwengine +// +// Created by Vittorio on 10/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import +#import "SDL_net.h" + +@interface GameSetup : NSObject { + NSDictionary *systemSettings; + NSDictionary *gameConfig; + + NSInteger ipcPort; + TCPsocket sd, csd; // Socket descriptor, Client socket descriptor +} + +@property (nonatomic, retain) NSDictionary *systemSettings; +@property (nonatomic, retain) NSDictionary *gameConfig; + +-(void) engineProtocol; +-(void) startThread:(NSString *)selector; +-(int) sendToEngine:(NSString *)string; +-(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor; +-(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams; +-(NSInteger) provideScheme:(NSString *)schemeName; + +-(const char **)getSettings; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GameSetup.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,450 @@ +// +// gameSetup.m +// hwengine +// +// Created by Vittorio on 10/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#include +#include + +#import "GameSetup.h" +#import "SDL_uikitappdelegate.h" +#import "SDL_net.h" +#import "PascalImports.h" +#import "CommodityFunctions.h" + +#define BUFFER_SIZE 256 +#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]); + +@implementation GameSetup + +@synthesize systemSettings, gameConfig; + +-(id) init { + if (self = [super init]) { + ipcPort = randomPort(); + + // should check they exist and throw and exection if not + NSDictionary *dictSett = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; + self.systemSettings = dictSett; + [dictSett release]; + + NSDictionary *dictGame = [[NSDictionary alloc] initWithContentsOfFile:GAMECONFIG_FILE()]; + self.gameConfig = dictGame; + [dictGame release]; + } + return self; +} + +-(NSString *)description { + return [NSString stringWithFormat:@"ipcport: %d\nsockets: %d,%d\n teams: %@\n systemSettings: %@",ipcPort,sd,csd,gameConfig,systemSettings]; +} + +-(void) dealloc { + [gameConfig release]; + [systemSettings release]; + [super dealloc]; +} + +#pragma mark - +#pragma mark Provider functions +// unpacks team data from the selected team.plist to a sequence of engine commands +-(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor { + /* + addteam <32charsMD5hash> + addhh + is 0 for human, 1-5 for bots (5 is the most stupid) + */ + + NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@", TEAMS_DIRECTORY(), teamName]; + NSDictionary *teamData = [[NSDictionary alloc] initWithContentsOfFile:teamFile]; + [teamFile release]; + + NSString *teamHashColorAndName = [[NSString alloc] initWithFormat:@"eaddteam %@ %@ %@", + [teamData objectForKey:@"hash"], [teamColor stringValue], [teamData objectForKey:@"teamname"]]; + [self sendToEngine: teamHashColorAndName]; + [teamHashColorAndName release]; + + NSString *grave = [[NSString alloc] initWithFormat:@"egrave %@", [teamData objectForKey:@"grave"]]; + [self sendToEngine: grave]; + [grave release]; + + NSString *fort = [[NSString alloc] initWithFormat:@"efort %@", [teamData objectForKey:@"fort"]]; + [self sendToEngine: fort]; + [fort release]; + + NSString *voicepack = [[NSString alloc] initWithFormat:@"evoicepack %@", [teamData objectForKey:@"voicepack"]]; + [self sendToEngine: voicepack]; + [voicepack release]; + + NSString *flag = [[NSString alloc] initWithFormat:@"eflag %@", [teamData objectForKey:@"flag"]]; + [self sendToEngine: flag]; + [flag release]; + + NSArray *hogs = [teamData objectForKey:@"hedgehogs"]; + for (int i = 0; i < numberOfPlayingHogs; i++) { + NSDictionary *hog = [hogs objectAtIndex:i]; + + NSString *hogLevelHealthAndName = [[NSString alloc] initWithFormat:@"eaddhh %@ %d %@", + [hog objectForKey:@"level"], initialHealth, [hog objectForKey:@"hogname"]]; + [self sendToEngine: hogLevelHealthAndName]; + [hogLevelHealthAndName release]; + + NSString *hogHat = [[NSString alloc] initWithFormat:@"ehat %@", [hog objectForKey:@"hat"]]; + [self sendToEngine: hogHat]; + [hogHat release]; + } + + [teamData release]; +} + +// unpacks ammostore data from the selected ammo.plist to a sequence of engine commands +-(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams { + + //NSDictionary *ammoData = [[NSDictionary alloc] initWithContentsOfFile:ammoDataFile]; + NSDictionary *ammoData = [[NSDictionary alloc] initWithObjectsAndKeys: + @"9391929422199121032235111001201000000211190911",@"ammostore_initialqt", + @"0405040541600655546554464776576666666155501000",@"ammostore_probability", + @"0000000000000205500000040007004000000000200000",@"ammostore_delay", + @"1311110312111111123114111111111111111211101111",@"ammostore_crate", nil]; + + + NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@", [ammoData objectForKey:@"ammostore_initialqt"]]; + [self sendToEngine: ammloadt]; + [ammloadt release]; + + NSString *ammprob = [[NSString alloc] initWithFormat:@"eammprob %@", [ammoData objectForKey:@"ammostore_probability"]]; + [self sendToEngine: ammprob]; + [ammprob release]; + + NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammdelay %@", [ammoData objectForKey:@"ammostore_delay"]]; + [self sendToEngine: ammdelay]; + [ammdelay release]; + + NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@", [ammoData objectForKey:@"ammostore_crate"]]; + [self sendToEngine: ammreinf]; + [ammreinf release]; + + // sent twice so it applies to both teams + NSString *ammstore = [[NSString alloc] initWithString:@"eammstore"]; + for (int i = 0; i < numberOfTeams; i++) + [self sendToEngine: ammstore]; + [ammstore release]; + + [ammoData release]; +} + +// unpacks scheme data from the selected scheme.plist to a sequence of engine commands +-(NSInteger) provideScheme:(NSString *)schemeName { + NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),schemeName]; + NSArray *scheme = [[NSArray alloc] initWithContentsOfFile:schemePath]; + [schemePath release]; + int result = 0; + int i = 0; + + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x01; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x10; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x04; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x08; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x20; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x40; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x80; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x100; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x200; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x400; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x800; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x2000; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x4000; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x8000; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x10000; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x20000; + if ([[scheme objectAtIndex:i++] boolValue]) + result |= 0x80000; + + NSString *flags = [[NSString alloc] initWithFormat:@"e$gmflags %d",result]; + [self sendToEngine:flags]; + [flags release]; + + NSString *dmgMod = [[NSString alloc] initWithFormat:@"e$damagepct %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:dmgMod]; + [dmgMod release]; + + NSString *turnTime = [[NSString alloc] initWithFormat:@"e$turntime %d",[[scheme objectAtIndex:i++] intValue] * 1000]; + [self sendToEngine:turnTime]; + [turnTime release]; + + result = [[scheme objectAtIndex:i++] intValue]; // initial health + + NSString *sdTime = [[NSString alloc] initWithFormat:@"e$sd_turns %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:sdTime]; + [sdTime release]; + + NSString *crateDrops = [[NSString alloc] initWithFormat:@"e$casefreq %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:crateDrops]; + [crateDrops release]; + + NSString *minesTime = [[NSString alloc] initWithFormat:@"e$minestime %d",[[scheme objectAtIndex:i++] intValue] * 1000]; + [self sendToEngine:minesTime]; + [minesTime release]; + + NSString *minesNumber = [[NSString alloc] initWithFormat:@"e$landadds %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:minesNumber]; + [minesNumber release]; + + NSString *dudMines = [[NSString alloc] initWithFormat:@"e$minedudpct %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:dudMines]; + [dudMines release]; + + NSString *explosives = [[NSString alloc] initWithFormat:@"e$explosives %d",[[scheme objectAtIndex:i++] intValue]]; + [self sendToEngine:explosives]; + [explosives release]; + + [scheme release]; + return result; +} + +#pragma mark - +#pragma mark Thread/Network relevant code +// select one of GameSetup method and execute it in a seprate thread +-(void) startThread: (NSString *) selector { + SEL usage = NSSelectorFromString(selector); + [NSThread detachNewThreadSelector:usage toTarget:self withObject:nil]; +} + +// wrapper that computes the length of the message and then sends the command string +-(int) sendToEngine: (NSString *)string { + uint8_t length = [string length]; + + SDLNet_TCP_Send(csd, &length , 1); + return SDLNet_TCP_Send(csd, [string UTF8String], length); +} + +// method that handles net setup with engine and keeps connection alive +-(void) engineProtocol { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + IPaddress ip; + int eProto; + BOOL clientQuit, serverQuit; + char buffer[BUFFER_SIZE], string[BUFFER_SIZE]; + uint8_t msgSize; + uint16_t gameTicks; + + serverQuit = NO; + + if (SDLNet_Init() < 0) { + NSLog(@"SDLNet_Init: %s", SDLNet_GetError()); + serverQuit = YES; + } + + // Resolving the host using NULL make network interface to listen + if (SDLNet_ResolveHost(&ip, NULL, ipcPort) < 0) { + NSLog(@"SDLNet_ResolveHost: %s\n", SDLNet_GetError()); + serverQuit = YES; + } + + // Open a connection with the IP provided (listen on the host's port) + if (!(sd = SDLNet_TCP_Open(&ip))) { + NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), ipcPort); + serverQuit = YES; + } + + NSLog(@"engineProtocol - Waiting for a client on port %d", ipcPort); + while (!serverQuit) { + // This check the sd if there is a pending connection. + // If there is one, accept that, and open a new socket for communicating + csd = SDLNet_TCP_Accept(sd); + if (NULL != csd) { + // Now we can communicate with the client using csd socket + // sd will remain opened waiting other connections + NSLog(@"engineProtocol - Client found"); + + //first byte of the command alwayas contain the size of the command + SDLNet_TCP_Recv(csd, &msgSize, sizeof(uint8_t)); + + SDLNet_TCP_Recv(csd, buffer, msgSize); + gameTicks = SDLNet_Read16 (&buffer[msgSize - 2]); + //NSLog(@"engineProtocol - %d: received [%s]", gameTicks, buffer); + + if ('C' == buffer[0]) { + NSLog(@"engineProtocol - sending game config"); + + // local game + [self sendToEngine:@"TL"]; + + // seed info + [self sendToEngine:[self.gameConfig objectForKey:@"seed_command"]]; + + // scheme (returns initial health) + NSInteger health = [self provideScheme:[self.gameConfig objectForKey:@"scheme"]]; + + // dimension of the map + [self sendToEngine:[self.gameConfig objectForKey:@"templatefilter_command"]]; + [self sendToEngine:[self.gameConfig objectForKey:@"mapgen_command"]]; + [self sendToEngine:[self.gameConfig objectForKey:@"mazesize_command"]]; + + // theme info + [self sendToEngine:[self.gameConfig objectForKey:@"theme_command"]]; + + NSArray *teamsConfig = [self.gameConfig objectForKey:@"teams_list"]; + for (NSDictionary *teamData in teamsConfig) { + [self provideTeamData:[teamData objectForKey:@"team"] + forHogs:[[teamData objectForKey:@"number"] intValue] + withHealth:health + ofColor:[teamData objectForKey:@"color"]]; + } + + [self provideAmmoData:nil forPlayingTeams:[teamsConfig count]]; + + clientQuit = NO; + } else { + NSLog(@"engineProtocolThread - wrong message or client closed connection"); + clientQuit = YES; + } + + while (!clientQuit){ + msgSize = 0; + memset(buffer, 0, BUFFER_SIZE); + memset(string, 0, BUFFER_SIZE); + if (SDLNet_TCP_Recv(csd, &msgSize, sizeof(uint8_t)) <= 0) + clientQuit = YES; + if (SDLNet_TCP_Recv(csd, buffer, msgSize) <=0) + clientQuit = YES; + + gameTicks = SDLNet_Read16(&buffer[msgSize - 2]); + //NSLog(@"engineProtocolThread - %d: received [%s]", gameTicks, buffer); + + switch (buffer[0]) { + case '?': + NSLog(@"Ping? Pong!"); + [self sendToEngine:@"!"]; + break; + case 'E': + NSLog(@"ERROR - last console line: [%s]", buffer); + clientQuit = YES; + break; + case 'e': + sscanf(buffer, "%*s %d", &eProto); + short int netProto = 0; + char *versionStr; + + HW_versionInfo(&netProto, &versionStr); + if (netProto == eProto) { + NSLog(@"Setting protocol version %d (%s)", eProto, versionStr); + } else { + NSLog(@"ERROR - wrong protocol number: [%s] - expecting %d", buffer, eProto); + clientQuit = YES; + } + + break; + case 'i': + switch (buffer[1]) { + case 'r': + NSLog(@"Winning team: %s", &buffer[2]); + break; + case 'k': + NSLog(@"Best Hedgehog: %s", &buffer[2]); + break; + } + break; + default: + // empty packet or just statistics + break; + // missing case for exiting right away + } + } + NSLog(@"Engine exited, closing server"); + // wait a little to let the client close cleanly + [NSThread sleepForTimeInterval:2]; + // Close the client socket + SDLNet_TCP_Close(csd); + serverQuit = YES; + } + } + + SDLNet_TCP_Close(sd); + SDLNet_Quit(); + + [[NSFileManager defaultManager] removeItemAtPath:GAMECONFIG_FILE() error:NULL]; + + [pool release]; + //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution. + //[NSThread exit]; +} + +#pragma mark - +#pragma mark Setting methods +// returns an array of c-strings that are read by engine at startup +-(const char **)getSettings { + NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; + NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + 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 *) * 9); + + /* + 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); + char *name = malloc(size); + // Get the platform name + sysctlbyname("hw.machine", name, &size, NULL, 0); + NSString *machine = [[NSString alloc] initWithUTF8String:name]; + free(name); + + const char **gameArgs = (const char**) malloc(sizeof(char*) * 9); + + // if the machine is less than iphone 3gs or less than ipod touch 3g use reduced graphics (land array) + if ([machine hasPrefix:@"iPhone1"] || ([machine hasPrefix:@"iPod"] && ([machine hasSuffix:@"1,1"] || [machine hasSuffix:@"2,1"]))) + gameArgs[8] = "1"; + else + gameArgs[8] = "0"; + [machine release]; + */ + + // prevents using an empty nickname + NSString *username; + NSString *originalUsername = [self.systemSettings objectForKey:@"username"]; + if ([originalUsername length] == 0) + username = [[NSString alloc] initWithFormat:@"MobileUser-%@",ipcString]; + else + username = [[NSString alloc] initWithString:originalUsername]; + + gameArgs[0] = [username UTF8String]; //UserNick + gameArgs[1] = [ipcString UTF8String]; //ipcPort + gameArgs[2] = [[[self.systemSettings objectForKey:@"sound"] stringValue] UTF8String]; //isSoundEnabled + gameArgs[3] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String]; //isMusicEnabled + gameArgs[4] = [localeString UTF8String]; //cLocaleFName + gameArgs[5] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String]; //cAltDamage + gameArgs[6] = [wSize UTF8String]; //cScreenHeight + gameArgs[7] = [hSize UTF8String]; //cScreenWidth + gameArgs[8] = NULL; //recordFileName + + [wSize release]; + [hSize release]; + [localeString release]; + [ipcString release]; + [username release]; + return gameArgs; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,31 @@ +// +// SettingsViewController.h +// hwengine +// +// Created by Vittorio on 08/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface GeneralSettingsViewController : UITableViewController { + NSMutableDictionary *settingsDictionary; + UITextField *textFieldBeingEdited; + UISwitch *musicSwitch; + UISwitch *soundSwitch; + UISwitch *altDamageSwitch; + BOOL isWriteNeeded; +} + +@property (nonatomic, retain) NSMutableDictionary *settingsDictionary; +@property (nonatomic, retain) UITextField *textFieldBeingEdited;; +@property (nonatomic, retain) UISwitch *musicSwitch; +@property (nonatomic, retain) UISwitch *soundSwitch; +@property (nonatomic, retain) UISwitch *altDamageSwitch; + +#define kNetworkFields 0 +#define kAudioFields 1 +#define kOtherFields 2 + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,398 @@ +// +// SettingsViewController.m +// hwengine +// +// Created by Vittorio on 08/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "GeneralSettingsViewController.h" +#import "CommodityFunctions.h" + +@implementation GeneralSettingsViewController +@synthesize settingsDictionary, textFieldBeingEdited, musicSwitch, soundSwitch, altDamageSwitch; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark textfield methods +// return to previous table +-(void) cancel:(id) sender { + if (textFieldBeingEdited != nil) + [self.textFieldBeingEdited resignFirstResponder]; +} + +// set the new value +-(BOOL) save:(id) sender { + if (textFieldBeingEdited != nil) { + if (textFieldBeingEdited.tag == 0) { + [self.settingsDictionary setObject:textFieldBeingEdited.text forKey:@"username"]; + } else { + [self.settingsDictionary setObject:textFieldBeingEdited.text forKey:@"password"]; + } + + isWriteNeeded = YES; + [self.textFieldBeingEdited resignFirstResponder]; + return YES; + } + return NO; +} + +// the textfield is being modified, update the navigation controller +-(void) textFieldDidBeginEditing:(UITextField *)aTextField{ + self.textFieldBeingEdited = aTextField; + UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from the settings table") + style:UIBarButtonItemStylePlain + target:self + action:@selector(cancel:)]; + self.navigationItem.leftBarButtonItem = cancelButton; + [cancelButton release]; + + UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from the settings table") + style:UIBarButtonItemStyleDone + target:self + action:@selector(save:)]; + self.navigationItem.rightBarButtonItem = saveButton; + [saveButton release]; +} + +// the textfield has been modified, check for empty strings and restore original navigation bar +-(void) textFieldDidEndEditing:(UITextField *)aTextField{ + self.textFieldBeingEdited = nil; + self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; + self.navigationItem.leftBarButtonItem = nil; +} + +// limit the size of the field to 64 characters like in original frontend +-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + int limit = 64; + return !([textField.text length] > limit && [string length] > range.length); +} + + +#pragma mark - +#pragma mark View Lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + self.musicSwitch = [[UISwitch alloc] init]; + self.soundSwitch = [[UISwitch alloc] init]; + self.altDamageSwitch = [[UISwitch alloc] init]; + [self.soundSwitch addTarget:self action:@selector(alsoTurnOffMusic:) forControlEvents:UIControlEventValueChanged]; + [self.musicSwitch addTarget:self action:@selector(dontTurnOnMusic:) forControlEvents:UIControlEventValueChanged]; + [self.altDamageSwitch addTarget:self action:@selector(justUpdateDictionary:) forControlEvents:UIControlEventValueChanged]; + + NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; + self.settingsDictionary = dictionary; + [dictionary release]; +} + +-(void) viewWillAppear:(BOOL)animated { + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; + isWriteNeeded = NO; + + musicSwitch.on = [[settingsDictionary objectForKey:@"music"] boolValue]; + soundSwitch.on = [[settingsDictionary objectForKey:@"sound"] boolValue]; + altDamageSwitch.on = [[settingsDictionary objectForKey:@"alternate"] boolValue]; + + [super viewWillAppear:animated]; +} + +-(void) viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + + if (isWriteNeeded) { + NSLog(@"writing preferences to file"); + [self.settingsDictionary writeToFile:SETTINGS_FILE() atomically:YES]; + isWriteNeeded = NO; + } +} + +#pragma mark - +// if the sound system is off, turn off also the background music +-(void) alsoTurnOffMusic:(id) sender { + [self.settingsDictionary setObject:[NSNumber numberWithBool:soundSwitch.on] forKey:@"sound"]; + if (YES == self.musicSwitch.on) { + [musicSwitch setOn:NO animated:YES]; + [self.settingsDictionary setObject:[NSNumber numberWithBool:musicSwitch.on] forKey:@"music"]; + } + isWriteNeeded = YES; +} + +// if the sound system is off, don't enable background music +-(void) dontTurnOnMusic:(id) sender { + if (NO == self.soundSwitch.on) { + [musicSwitch setOn:NO animated:YES]; + } else { + [self.settingsDictionary setObject:[NSNumber numberWithBool:musicSwitch.on] forKey:@"music"]; + isWriteNeeded = YES; + } +} + +-(void) justUpdateDictionary:(id) sender { + UISwitch *theSwitch = (UISwitch *)sender; + [self.settingsDictionary setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; + isWriteNeeded = YES; +} + +/* +#pragma mark - +#pragma mark UIActionSheet Methods +-(IBAction) deleteData: (id)sender { + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") + delegate:self + cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") + destructiveButtonTitle:NSLocalizedString(@"As sure as I can be!", @"") + otherButtonTitles:nil]; + [actionSheet showInView:self.view]; + [actionSheet release]; +} + +-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { + if ([actionSheet cancelButtonIndex] != buttonIndex) { + // get the documents dirctory + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + + // get the content of the directory + NSFileManager *fm = [NSFileManager defaultManager]; + NSArray *dirContent = [fm directoryContentsAtPath:documentsDirectory]; + NSError *error; + + // delete data + for (NSString *fileName in dirContent) { + [fm removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:fileName] error:&error]; + } + + // force resetting + UIAlertView *anAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Hit Home Button to Exit", @"") + message:NSLocalizedString(@"\nEverything is gone!\nNow you need to restart the game...", @"") + delegate:self + cancelButtonTitle:nil + otherButtonTitles:nil]; + [anAlert show]; + [anAlert release]; + } +} +*/ + +#pragma mark - +#pragma mark TableView Methods +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + switch (section) { + case kNetworkFields: + return 2; + break; + case kAudioFields: + return 2; + break; + case kOtherFields: + return 1; + break; + default: + break; + } + return 0; +} + +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cellIdentifier = @"systemSettingsCell"; + NSInteger row = [indexPath row]; + NSInteger section = [indexPath section]; + + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; + if (nil == cell) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; + if (section == kNetworkFields) { + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(-15, 10, 100, 25)]; + label.textAlignment = UITextAlignmentRight; + label.backgroundColor = [UIColor clearColor]; + label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; + if (row == 0) + label.text = NSLocalizedString(@"Nickname","from the settings table"); + else + label.text = NSLocalizedString(@"Password","from the settings table"); + [cell.contentView addSubview:label]; + [label release]; + + UITextField *aTextField = [[UITextField alloc] initWithFrame: + CGRectMake(110, 12, (cell.frame.size.width + cell.frame.size.width/3) - 90, 25)]; + aTextField.clearsOnBeginEditing = NO; + aTextField.returnKeyType = UIReturnKeyDone; + aTextField.adjustsFontSizeToFitWidth = YES; + aTextField.delegate = self; + aTextField.tag = row; + aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; + [cell.contentView addSubview:aTextField]; + [aTextField release]; + } + } + + cell.accessoryType = UITableViewCellAccessoryNone; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.imageView.image = nil; + + UITextField *aTextField; + switch (section) { + case kNetworkFields: + for (UIView *oneView in cell.contentView.subviews) + if ([oneView isMemberOfClass:[UITextField class]]) + aTextField = (UITextField *)oneView; + + switch (row) { + case 0: + aTextField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@""); + aTextField.text = [self.settingsDictionary objectForKey:@"username"]; + break; + case 1: + aTextField.placeholder = NSLocalizedString(@"Insert your password",@""); + aTextField.text = [self.settingsDictionary objectForKey:@"password"]; + aTextField.secureTextEntry = YES; + break; + default: + break; + } + break; + + case kAudioFields: + switch (row) { + case 0: + cell.textLabel.text = NSLocalizedString(@"Sound", @""); + cell.accessoryView = soundSwitch; + break; + case 1: + cell.textLabel.text = NSLocalizedString(@"Music", @""); + cell.accessoryView = musicSwitch; + break; + default: + break; + } + break; + + case kOtherFields: + cell.selectionStyle = UITableViewCellSelectionStyleNone; + cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @""); + cell.accessoryView = altDamageSwitch; + break; + default: + break; + } + return cell; +} + +-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + NSString *sectionTitle = nil; + switch (section) { + case kNetworkFields: + sectionTitle = NSLocalizedString(@"Network Configuration", @""); + break; + case kAudioFields: + sectionTitle = NSLocalizedString(@"Audio Preferences", @""); + break; + case kOtherFields: + sectionTitle = NSLocalizedString(@"Other Settings", @""); + break; + default: + NSLog(@"Nope"); + break; + } + return sectionTitle; +} + +/* +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)] autorelease]; + UILabel *headerLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10, 20, 300, 40)] autorelease]; + headerLabel.textColor = [UIColor lightGrayColor]; + headerLabel.shadowColor = [UIColor blackColor]; + headerLabel.shadowOffset = CGSizeMake(0, 1); + headerLabel.font = [UIFont boldSystemFontOfSize:20]; + headerLabel.backgroundColor = [UIColor clearColor]; + + switch (section) { + case kNetworkFields: + headerLabel.text = NSLocalizedString(@"Network Configuration", @""); + break; + case kAudioFields: + headerLabel.text = NSLocalizedString(@"Audio Preferences", @""); + break; + case kOtherFields: + headerLabel.text = NSLocalizedString(@"Other Settings", @""); + break; + default: + NSLog(@"Warning: unset case value in titleForHeaderInSection!"); + headerLabel.text = @"!"; + break; + } + + [containerView addSubview:headerLabel]; + return containerView; +} + +-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (kAudioFields == [indexPath section] && 2 == [indexPath row]) + return volumeCell.frame.size.height; + else + return table.rowHeight; +} + +-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 57.0; +} +*/ + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell; + if (kNetworkFields == [indexPath section]) { + cell = [aTableView cellForRowAtIndexPath:indexPath]; + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + textFieldBeingEdited = (UITextField *)oneView; + [textFieldBeingEdited becomeFirstResponder]; + } + } + [aTableView deselectRowAtIndexPath:indexPath animated:NO]; + } +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.settingsDictionary = nil; + self.textFieldBeingEdited = nil; + self.musicSwitch = nil; + self.soundSwitch = nil; + self.altDamageSwitch = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [settingsDictionary release]; + [textFieldBeingEdited release]; + [musicSwitch release]; + [soundSwitch release]; + [altDamageSwitch release]; + [super dealloc]; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GravesViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GravesViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,23 @@ +// +// GravesViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface GravesViewController : UITableViewController { + NSMutableDictionary *teamDictionary; + + NSArray *graveArray; + NSIndexPath *lastIndexPath; +} + +@property (nonatomic,retain) NSMutableDictionary *teamDictionary; +@property (nonatomic,retain) NSArray *graveArray; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/GravesViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GravesViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,127 @@ +// +// GravesViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "GravesViewController.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation GravesViewController +@synthesize teamDictionary, graveArray, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + // load all the grave names and store them into graveArray + self.graveArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:GRAVES_DIRECTORY() error:NULL]; +} + +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.tableView reloadData]; + // this moves the tableview to the top + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.graveArray count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + + NSString *grave = [self.graveArray objectAtIndex:[indexPath row]]; + cell.textLabel.text = [grave stringByDeletingPathExtension]; + + if ([grave isEqualToString:[self.teamDictionary objectForKey:@"grave"]]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + NSString *graveFilePath = [[NSString alloc] initWithFormat:@"%@/%@",GRAVES_DIRECTORY(),grave]; + // because we also have multi frame graves, let's take the first one only + UIImage *graveSprite = [[UIImage alloc] initWithContentsOfFile:graveFilePath andCutAt:CGRectMake(0, 0, 32, 32)]; + [graveFilePath release]; + cell.imageView.image = graveSprite; + [graveSprite release]; + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + [teamDictionary setObject:[[graveArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"grave"]; + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + self.lastIndexPath = indexPath; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.navigationController popViewControllerAnimated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + self.lastIndexPath = nil; + self.teamDictionary = nil; + self.graveArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +- (void)dealloc { + [graveArray release]; + [teamDictionary release]; + [lastIndexPath release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/HogHatViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,27 @@ +// +// HogHatViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface HogHatViewController : UITableViewController { + NSDictionary *teamDictionary; + NSInteger selectedHog; + + NSArray *hatArray; + UIImage *normalHogSprite; + NSIndexPath *lastIndexPath; +} + +@property (nonatomic,retain) NSDictionary *teamDictionary; +@property (nonatomic) NSInteger selectedHog; +@property (nonatomic,retain) NSArray *hatArray; +@property (nonatomic,retain) UIImage *normalHogSprite; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/HogHatViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,149 @@ +// +// HogHatViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "HogHatViewController.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation HogHatViewController +@synthesize teamDictionary, hatArray, normalHogSprite, lastIndexPath, selectedHog; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +- (void)viewDidLoad { + [super viewDidLoad]; + + // load all the hat file names and store them into hatArray + NSString *hatsDirectory = HATS_DIRECTORY(); + NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:hatsDirectory error:NULL]; + self.hatArray = array; + + // load the base hog image, drawing will occure in cellForRow... + NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; + UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; + [normalHogFile release]; + self.normalHogSprite = hogSprite; + [hogSprite release]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + self.title = [[[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog] objectForKey:@"hogname"]; + + // this updates the hog name and its hat + [self.tableView reloadData]; + // this moves the tableview to the top + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.hatArray count]; +} + +// Customize the appearance of table view cells. +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + + NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog]; + NSString *hat = [hatArray objectAtIndex:[indexPath row]]; + cell.textLabel.text = [hat stringByDeletingPathExtension]; + + NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat]; + UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; + [hatFile release]; + cell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)]; + [hatSprite release]; + + if ([hat isEqualToString:[hog objectForKey:@"hat"]]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + // if the two selected rows differ update data on the hog dictionary and reload table content + // TODO: maybe this section could be cleaned up + NSDictionary *oldHog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:selectedHog]; + + NSMutableDictionary *newHog = [[NSMutableDictionary alloc] initWithDictionary: oldHog]; + [newHog setObject:[[hatArray objectAtIndex:newRow] stringByDeletingPathExtension] forKey:@"hat"]; + [[teamDictionary objectForKey:@"hedgehogs"] replaceObjectAtIndex:selectedHog withObject:newHog]; + [newHog release]; + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + self.lastIndexPath = indexPath; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.navigationController popViewControllerAnimated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + self.lastIndexPath = nil; + self.normalHogSprite = nil; + self.teamDictionary = nil; + self.hatArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +- (void)dealloc { + [hatArray release]; + [teamDictionary release]; + [normalHogSprite release]; + [lastIndexPath release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/LevelViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/LevelViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,25 @@ +// +// LevelViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface LevelViewController : UITableViewController { + NSDictionary *teamDictionary; + + NSArray *levelArray; + NSArray *levelSprites; + NSIndexPath *lastIndexPath; +} + +@property (nonatomic,retain) NSDictionary *teamDictionary; +@property (nonatomic,retain) NSArray *levelArray; +@property (nonatomic,retain) NSArray *levelSprites; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/LevelViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,177 @@ +// +// LevelViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "LevelViewController.h" +#import "CommodityFunctions.h" + + +@implementation LevelViewController +@synthesize teamDictionary, levelArray, levelSprites, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +- (void)viewDidLoad { + [super viewDidLoad]; + + NSArray *array = [[NSArray alloc] initWithObjects: + NSLocalizedString(@"Human",@""), + NSLocalizedString(@"Brutal",@""), + NSLocalizedString(@"Aggressive",@""), + NSLocalizedString(@"Bully",@""), + NSLocalizedString(@"Average",@""), + NSLocalizedString(@"Weaky",@""), + nil]; + self.levelArray = array; + [array release]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.tableView reloadData]; + // this moves the tableview to the top + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.levelArray count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + NSInteger row = [indexPath row]; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + cell.textLabel.text = [levelArray objectAtIndex:row]; + NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0]; + if ([[hog objectForKey:@"level"] intValue] == row) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + NSString *botlevelPath = [[NSString alloc] initWithFormat:@"%@/%d.png",BOTLEVELS_DIRECTORY(),row]; + UIImage *levelImage = [[UIImage alloc] initWithContentsOfFile:botlevelPath]; + [botlevelPath release]; + cell.imageView.image = levelImage; + [levelImage release]; + + return cell; +} + + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + + +#pragma mark - +#pragma mark Table view delegate +- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + NSMutableArray *hogs = [teamDictionary objectForKey:@"hedgehogs"]; + + for (NSMutableDictionary *hog in hogs) { + [hog setObject:[NSNumber numberWithInt:newRow] forKey:@"level"]; + } + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + [self.tableView reloadData]; + + self.lastIndexPath = indexPath; + [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.navigationController popViewControllerAnimated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.lastIndexPath = nil; + self.teamDictionary = nil; + self.levelArray = nil; + self.levelSprites = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [levelArray release]; + [levelSprites release]; + [teamDictionary release]; + [lastIndexPath release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MainMenuViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,23 @@ +// +// MainMenuViewController.h +// hwengine +// +// Created by Vittorio on 08/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class SplitViewRootController; +@class GameConfigViewController; + +@interface MainMenuViewController : UIViewController { + UILabel *versionLabel; + SplitViewRootController *settingsViewController; + GameConfigViewController *gameConfigViewController; +} + +@property (nonatomic,retain) IBOutlet UILabel *versionLabel; + +-(IBAction) switchViews:(id)sender; +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,177 @@ +// +// MainMenuViewController.m +// hwengine +// +// Created by Vittorio on 08/01/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "MainMenuViewController.h" +#import "SDL_uikitappdelegate.h" +#import "PascalImports.h" +#import "GameConfigViewController.h" +#import "SplitViewRootController.h" +#import "CommodityFunctions.h" + +@implementation MainMenuViewController +@synthesize versionLabel; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + if (settingsViewController.view.superview == nil) + settingsViewController = nil; + if (gameConfigViewController.view.superview == nil) + gameConfigViewController = nil; + MSG_MEMCLEAN(); +} + +-(void) viewDidLoad { + char *ver; + HW_versionInfo(NULL, &ver); + NSString *versionNumber = [[NSString alloc] initWithCString:ver]; + self.versionLabel.text = versionNumber; + [versionNumber release]; + + // listen to request to remove the modalviewcontroller + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(dismissModalViewController) + name: @"dismissModalView" + object:nil]; + + // initialize some files the first time we load the game + if (!([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()])) + [NSThread detachNewThreadSelector:@selector(checkFirstRun) toTarget:self withObject:nil]; + + [super viewDidLoad]; +} + +// this is called to verify whether it's the first time the app is launched +// if it is it blocks user interaction with an alertView until files are created +-(void) checkFirstRun { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSLog(@"First time run, creating settings files at %@", SETTINGS_FILE()); + + // show a popup with an indicator to make the user wait + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Please wait",@"") + message:nil + delegate:nil + cancelButtonTitle:nil + otherButtonTitles:nil]; + [alert show]; + + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] + initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50); + [indicator startAnimating]; + [alert addSubview:indicator]; + [indicator release]; + + // create a team + createTeamNamed(@"Pirates"); + createTeamNamed(@"Ninjas"); + + createSchemeNamed(@"Default"); + + // create settings.plist + NSMutableDictionary *saveDict = [[NSMutableDictionary alloc] init]; + + [saveDict setObject:@"" forKey:@"username"]; + [saveDict setObject:@"" forKey:@"password"]; + [saveDict setObject:[NSNumber numberWithBool:YES] forKey:@"music"]; + [saveDict setObject:[NSNumber numberWithBool:YES] forKey:@"sound"]; + [saveDict setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"]; + + [saveDict writeToFile:SETTINGS_FILE() atomically:YES]; + [saveDict release]; + + // ok let the user take control + [alert dismissWithClickedButtonIndex:0 animated:YES]; + [alert release]; + + [pool release]; + [NSThread exit]; +} + +#pragma mark - +-(IBAction) switchViews:(id) sender { + UIButton *button = (UIButton *)sender; + UIAlertView *alert; + NSString *debugStr, *configNibName; + + switch (button.tag) { + case 0: + // bug in UIModalTransitionStylePartialCurl, displays the controller awkwardly if it is not allocated every time + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + configNibName = @"GameConfigViewController-iPad"; + else + configNibName = @"GameConfigViewController-iPhone"; + + gameConfigViewController = [[GameConfigViewController alloc] initWithNibName:configNibName bundle:nil]; +#ifdef __IPHONE_3_2 + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + gameConfigViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl; +#endif + [self presentModalViewController:gameConfigViewController animated:YES]; + break; + case 2: + if (nil == settingsViewController) { + settingsViewController = [[SplitViewRootController alloc] initWithNibName:nil bundle:nil]; + settingsViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; + } + + [self presentModalViewController:settingsViewController animated:YES]; + break; + case 3: + debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()]; + UITextView *scroll = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)]; + scroll.text = debugStr; + [debugStr release]; + scroll.editable = NO; + + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; + [btn addTarget:scroll action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside]; + btn.backgroundColor = [UIColor blackColor]; + btn.frame = CGRectMake(self.view.frame.size.height-70, 0, 70, 70); + [scroll addSubview:btn]; + [self.view addSubview:scroll]; + [scroll release]; + break; + default: + alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented" + message:@"Sorry, this feature is not yet implemented" + delegate:nil + cancelButtonTitle:@"Well, don't worry" + otherButtonTitles:nil]; + [alert show]; + [alert release]; + break; + } +} + +// allows child controllers to return to the main controller +-(void) dismissModalViewController { + [self dismissModalViewControllerAnimated:YES]; +} + + +-(void) viewDidUnload { + self.versionLabel = nil; + gameConfigViewController = nil; + settingsViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [versionLabel release]; + [settingsViewController release]; + [gameConfigViewController release]; + [super dealloc]; +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MapConfigViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,70 @@ +// +// MapConfigViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 22/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import +#import "SDL_net.h" + +@interface MapConfigViewController : UIViewController { + TCPsocket sd, csd; + NSInteger oldValue; //slider + NSInteger oldPage; //segmented control + BOOL busy; + + // objects read (mostly) by parent view + NSInteger maxHogs; + NSString *seedCommand; + NSString *templateFilterCommand; + NSString *mapGenCommand; + NSString *mazeSizeCommand; + NSString *themeCommand; + + // various widgets in the view + UIButton *previewButton; + UITableView *tableView; + UILabel *maxLabel; + UILabel *sizeLabel; + UISegmentedControl *segmentedControl; + UISlider *slider; + + // internal objects + NSIndexPath *lastIndexPath; + NSArray *themeArray; + NSArray *mapArray; +} + +@property (nonatomic) NSInteger maxHogs; +@property (nonatomic) BOOL busy; +@property (nonatomic,retain) NSString *seedCommand; +@property (nonatomic,retain) NSString *templateFilterCommand; +@property (nonatomic,retain) NSString *mapGenCommand; +@property (nonatomic,retain) NSString *mazeSizeCommand; +@property (nonatomic,retain) NSString *themeCommand; + +@property (nonatomic,retain) IBOutlet UIButton *previewButton; +@property (nonatomic,retain) IBOutlet UITableView *tableView; +@property (nonatomic,retain) IBOutlet UILabel *maxLabel; +@property (nonatomic,retain) IBOutlet UILabel *sizeLabel; +@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl; +@property (nonatomic,retain) IBOutlet UISlider *slider; + +@property (nonatomic,retain) NSIndexPath *lastIndexPath; +@property (nonatomic,retain) NSArray *themeArray; +@property (nonatomic,retain) NSArray *mapArray; + +-(IBAction) updatePreview; +-(IBAction) sliderChanged:(id) sender; +-(IBAction) sliderEndedChanging:(id) sender; +-(IBAction) segmentedControlChanged:(id) sender; +-(void) turnOnWidgets; +-(void) turnOffWidgets; +-(void) setLabelText:(NSString *)str; +-(void) setButtonImage:(UIImage *)img; + +-(const uint8_t *)engineProtocol:(NSInteger) port; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,565 @@ +// +// MapConfigViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 22/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "MapConfigViewController.h" +#import "PascalImports.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" +#import "SDL_net.h" +#import + +#define INDICATOR_TAG 7654 + +@implementation MapConfigViewController +@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, + tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, themeArray, mapArray, busy; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +#pragma mark - +#pragma mark Preview Handling +-(int) sendToEngine: (NSString *)string { + unsigned char length = [string length]; + + SDLNet_TCP_Send(csd, &length , 1); + return SDLNet_TCP_Send(csd, [string UTF8String], length); +} + +-(const uint8_t *)engineProtocol:(NSInteger) port { + IPaddress ip; + BOOL serverQuit = NO; + static uint8_t map[128*32]; + + if (SDLNet_Init() < 0) { + NSLog(@"SDLNet_Init: %s", SDLNet_GetError()); + serverQuit = YES; + } + + // Resolving the host using NULL make network interface to listen + if (SDLNet_ResolveHost(&ip, NULL, port) < 0) { + NSLog(@"SDLNet_ResolveHost: %s\n", SDLNet_GetError()); + serverQuit = YES; + } + + // Open a connection with the IP provided (listen on the host's port) + if (!(sd = SDLNet_TCP_Open(&ip))) { + NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), port); + serverQuit = YES; + } + + // launch the preview here so that we're sure the tcp channel is open + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port); + pthread_detach(thread_id); + + DLog(@"Waiting for a client on port %d", port); + while (!serverQuit) { + /* This check the sd if there is a pending connection. + * If there is one, accept that, and open a new socket for communicating */ + csd = SDLNet_TCP_Accept(sd); + if (NULL != csd) { + DLog(@"Client found"); + + [self sendToEngine:self.seedCommand]; + [self sendToEngine:self.templateFilterCommand]; + [self sendToEngine:self.mapGenCommand]; + [self sendToEngine:self.mazeSizeCommand]; + [self sendToEngine:@"!"]; + + memset(map, 0, 128*32); + SDLNet_TCP_Recv(csd, map, 128*32); + SDLNet_TCP_Recv(csd, &maxHogs, sizeof(uint8_t)); + + SDLNet_TCP_Close(csd); + serverQuit = YES; + } + } + + SDLNet_TCP_Close(sd); + SDLNet_Quit(); + return map; +} + +-(void) drawingThread { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + // select the port for IPC and launch the preview generation through engineProtocol: + int port = randomPort(); + const uint8_t *map = [self engineProtocol:port]; + uint8_t mapExp[128*32*8]; + + // draw the buffer (1 pixel per component, 0= transparent 1= color) + int k = 0; + for (int i = 0; i < 32*128; i++) { + unsigned char byte = map[i]; + for (int j = 0; j < 8; j++) { + // select the color based on the leftmost bit + if ((byte & 0x80) != 0) + mapExp[k] = 100; + else + mapExp[k] = 255; + // shift to next bit + byte <<= 1; + k++; + } + } + CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); + CGContextRef bitmapImage = CGBitmapContextCreate(mapExp, 256, 128, 8, 256, colorspace, kCGImageAlphaNone); + CGColorSpaceRelease(colorspace); + + CGImageRef previewCGImage = CGBitmapContextCreateImage(bitmapImage); + UIImage *previewImage = [[UIImage alloc] initWithCGImage:previewCGImage]; + CGImageRelease(previewCGImage); + + // set the preview image (autoreleased) in the button and the maxhog label on the main thread to prevent a leak + [self performSelectorOnMainThread:@selector(setButtonImage:) withObject:[[previewImage retain] makeRoundCornersOfSize:CGSizeMake(12, 12)] waitUntilDone:NO]; + [self performSelectorOnMainThread:@selector(setLabelText:) withObject:[NSString stringWithFormat:@"%d", maxHogs] waitUntilDone:NO]; + + // restore functionality of button and remove the spinning wheel on the main thread to prevent a leak + [self performSelectorOnMainThread:@selector(turnOnWidgets) withObject:nil waitUntilDone:NO]; + + [pool release]; + //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution. + //[NSThread exit]; + + /* + // http://developer.apple.com/mac/library/qa/qa2001/qa1037.html + UIGraphicsBeginImageContext(CGSizeMake(256,128)); + CGContextRef context = UIGraphicsGetCurrentContext(); + UIGraphicsPushContext(context); + + CGContextSetRGBFillColor(context, 0.5, 0.5, 0.7, 1.0); + CGContextFillRect(context,CGRectMake(xc,yc,1,1)); + + UIGraphicsPopContext(); + UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + */ +} + +-(IBAction) updatePreview { + // don't generate a new preview while it's already generating one + if (busy) + return; + + // generate a seed + CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); + NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); + CFRelease(uuid); + NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; + [seed release]; + self.seedCommand = seedCmd; + [seedCmd release]; + + NSIndexPath *theIndex; + if (segmentedControl.selectedSegmentIndex != 1) { + // prevent other events and add an activity while the preview is beign generated + [self turnOffWidgets]; + + // remove the current preview + [self.previewButton setImage:nil forState:UIControlStateNormal]; + + // add a very nice spinning wheel + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] + initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + indicator.center = CGPointMake(previewButton.bounds.size.width / 2, previewButton.bounds.size.height / 2); + indicator.tag = INDICATOR_TAG; + [indicator startAnimating]; + [self.previewButton addSubview:indicator]; + [indicator release]; + + // let's draw in a separate thread so the gui can work; at the end it restore other widgets + [NSThread detachNewThreadSelector:@selector(drawingThread) toTarget:self withObject:nil]; + + theIndex = [NSIndexPath indexPathForRow:(random()%[self.themeArray count]) inSection:0]; + } else { + theIndex = [NSIndexPath indexPathForRow:(random()%[self.mapArray count]) inSection:0]; + } + [self.tableView reloadData]; + [self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; + [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES]; +} + +-(void) updatePreviewWithMap:(NSInteger) index { + // change the preview button + NSString *fileImage = [[NSString alloc] initWithFormat:@"%@/%@/preview.png", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]]; + UIImage *image = [[UIImage alloc] initWithContentsOfFile:fileImage]; + [fileImage release]; + [self.previewButton setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:UIControlStateNormal]; + + // update label + maxHogs = 18; + NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]]; + NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL]; + [fileCfg release]; + NSArray *split = [contents componentsSeparatedByString:@"\n"]; + + // if the number is not set we keep 18 standard; + // sometimes it's not set but there are trailing characters, we get around them with the second equation + if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0) + maxHogs = [[split objectAtIndex:1] intValue]; + [contents release]; + NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs]; + self.maxLabel.text = max; + [max release]; +} + +-(void) turnOffWidgets { + busy = YES; + self.previewButton.alpha = 0.5f; + self.previewButton.enabled = NO; + self.maxLabel.text = @"..."; + self.segmentedControl.enabled = NO; + self.slider.enabled = NO; +} + +-(void) turnOnWidgets { + self.previewButton.alpha = 1.0f; + self.previewButton.enabled = YES; + self.segmentedControl.enabled = YES; + self.slider.enabled = YES; + busy = NO; + + UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.previewButton viewWithTag:INDICATOR_TAG]; + if (indicator) { + [indicator stopAnimating]; + [indicator removeFromSuperview]; + } +} + +-(void) setLabelText:(NSString *)str { + self.maxLabel.text = str; +} + +-(void) setButtonImage:(UIImage *)img { + [self.previewButton setBackgroundImage:img forState:UIControlStateNormal]; +} + +-(void) restoreBackgroundImage { + // white rounded rectangle as background image for previewButton + UIGraphicsBeginImageContext(CGSizeMake(256,128)); + CGContextRef context = UIGraphicsGetCurrentContext(); + UIGraphicsPushContext(context); + + CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); + CGContextFillRect(context,CGRectMake(0,0,256,128)); + + UIGraphicsPopContext(); + UIImage *bkgImg = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + [self.previewButton setBackgroundImage:[[bkgImg retain] makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:UIControlStateNormal]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { + if (self.segmentedControl.selectedSegmentIndex != 1) + return [themeArray count]; + else + return [mapArray count]; +} + +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + NSInteger row = [indexPath row]; + + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + + if (self.segmentedControl.selectedSegmentIndex != 1) { + // the % prevents a strange bug that occurs sporadically + NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]]; + cell.textLabel.text = themeName; + UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]]; + cell.imageView.image = image; + [image release]; + } else { + cell.textLabel.text = [self.mapArray objectAtIndex:row]; + cell.imageView.image = nil; + } + + if (row == [self.lastIndexPath row]) + cell.accessoryType = UITableViewCellAccessoryCheckmark; + else + cell.accessoryType = UITableViewCellAccessoryNone; + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + if (self.segmentedControl.selectedSegmentIndex != 1) { + NSString *theme = [self.themeArray objectAtIndex:newRow]; + self.themeCommand = [NSString stringWithFormat:@"etheme %@", theme]; + } else + [self updatePreviewWithMap:newRow]; + + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + + self.lastIndexPath = indexPath; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +#pragma mark - +#pragma mark slider & segmentedControl +// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl +// no methods are called by this routine and you can pass nil to it +-(IBAction) sliderChanged:(id) sender { + NSString *labelText; + NSString *templateCommand; + NSString *mazeCommand; + + switch ((int)(self.slider.value*100)) { + case 0: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"Wacky",@""); + } else { + labelText = NSLocalizedString(@"Large Floating Islands",@""); + } + templateCommand = @"e$template_filter 5"; + mazeCommand = @"e$maze_size 5"; + break; + case 1: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"Cavern",@""); + } else { + labelText = NSLocalizedString(@"Medium Floating Islands",@""); + } + templateCommand = @"e$template_filter 4"; + mazeCommand = @"e$maze_size 4"; + break; + case 2: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"Small",@""); + } else { + labelText = NSLocalizedString(@"Small Floating Islands",@""); + } + templateCommand = @"e$template_filter 1"; + mazeCommand = @"e$maze_size 3"; + break; + case 3: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"Medium",@""); + } else { + labelText = NSLocalizedString(@"Large Tunnels",@""); + } + templateCommand = @"e$template_filter 2"; + mazeCommand = @"e$maze_size 2"; + break; + case 4: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"Large",@""); + } else { + labelText = NSLocalizedString(@"Medium Tunnels",@""); + } + templateCommand = @"e$template_filter 3"; + mazeCommand = @"e$maze_size 1"; + break; + case 5: + if (self.segmentedControl.selectedSegmentIndex == 0) { + labelText = NSLocalizedString(@"All",@""); + } else { + labelText = NSLocalizedString(@"Small Tunnels",@""); + } + templateCommand = @"e$template_filter 0"; + mazeCommand = @"e$maze_size 0"; + break; + default: + labelText = nil; + templateCommand = nil; + mazeCommand = nil; + break; + } + + self.sizeLabel.text = labelText; + self.templateFilterCommand = templateCommand; + self.mazeSizeCommand = mazeCommand; +} + +// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up +-(IBAction) sliderEndedChanging:(id) sender { + int num = (int) (self.slider.value * 100); + if (oldValue != num) { + [self updatePreview]; + oldValue = num; + } +} + +// perform actions based on the activated section, then call updatePreview to visually update the selection +// updatePreview will call didSelectRowAtIndexPath which will call the right update routine) +// and if necessary update the table with a slide animation +-(IBAction) segmentedControlChanged:(id) sender { + NSString *mapgen; + NSInteger newPage = self.segmentedControl.selectedSegmentIndex; + + switch (newPage) { + case 0: // Random + mapgen = @"e$mapgen 0"; + [self sliderChanged:nil]; + self.slider.enabled = YES; + break; + + case 1: // Map + mapgen = @"e$mapgen 0"; + self.slider.enabled = NO; + self.sizeLabel.text = @"."; + [self restoreBackgroundImage]; + break; + + case 2: // Maze + mapgen = @"e$mapgen 1"; + [self sliderChanged:nil]; + self.slider.enabled = YES; + break; + + default: + mapgen = nil; + break; + } + self.mapGenCommand = mapgen; + [self updatePreview]; + + // nice animation for updating the table when appropriate (on iphone) + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) + if (((oldPage == 0 || oldPage == 2) && newPage == 1) || + (oldPage == 1 && (newPage == 0 || newPage == 2))) { + [UIView beginAnimations:@"moving out table" context:NULL]; + self.tableView.frame = CGRectMake(480, 0, 185, 276); + [UIView commitAnimations]; + [self performSelector:@selector(moveTable) withObject:nil afterDelay:0.2]; + } + oldPage = newPage; +} + +// update data when table is not visible and then show it +-(void) moveTable { + [self.tableView reloadData]; + + [UIView beginAnimations:@"moving in table" context:NULL]; + self.tableView.frame = CGRectMake(295, 0, 185, 276); + [UIView commitAnimations]; +} + +#pragma mark - +#pragma mark view management +-(void) viewDidLoad { + [super viewDidLoad]; + + srandom(time(NULL)); + + CGSize screenSize = [[UIScreen mainScreen] bounds].size; + self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); + + // themes.cfg contains all the user-selectable themes + NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] + encoding:NSUTF8StringEncoding + error:NULL]; + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]]; + [string release]; + // remove a trailing "" element + [array removeLastObject]; + self.themeArray = array; + [array release]; + self.mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; + + self.tableView.rowHeight = 42; + busy = NO; + + // draw a white background + [self restoreBackgroundImage]; + + // initialize some "default" values + self.sizeLabel.text = NSLocalizedString(@"All",@""); + self.slider.value = 0.05f; + self.segmentedControl.selectedSegmentIndex = 0; + + self.templateFilterCommand = @"e$template_filter 0"; + self.mazeSizeCommand = @"e$maze_size 0"; + self.mapGenCommand = @"e$mapgen 0"; + self.lastIndexPath = [NSIndexPath indexPathForRow:0 inSection:0]; + + oldValue = 5; + oldPage = 0; +} + +-(void) viewDidAppear:(BOOL) animated { + [super viewDidAppear:animated]; + [self updatePreview]; +} + +#pragma mark - +#pragma mark memory +-(void) didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +-(void) viewDidUnload { + self.previewButton = nil; + self.seedCommand = nil; + self.templateFilterCommand = nil; + self.mapGenCommand = nil; + self.mazeSizeCommand = nil; + self.themeCommand = nil; + + self.previewButton = nil; + self.tableView = nil; + self.maxLabel = nil; + self.sizeLabel = nil; + self.segmentedControl = nil; + self.slider = nil; + + self.lastIndexPath = nil; + self.themeArray = nil; + self.mapArray = nil; + + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [seedCommand release]; + [templateFilterCommand release]; + [mapGenCommand release]; + [mazeSizeCommand release]; + [themeCommand release]; + + [previewButton release]; + [tableView release]; + [maxLabel release]; + [sizeLabel release]; + [segmentedControl release]; + [slider release]; + + [lastIndexPath release]; + [themeArray release]; + [mapArray release]; + + [super dealloc]; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MasterViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MasterViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,34 @@ +// +// MasterViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@class DetailViewController; +@class GeneralSettingsViewController; +@class TeamSettingsViewController; +@class WeaponSettingsViewController; +@class SchemeSettingsViewController; + +@interface MasterViewController : UITableViewController { + DetailViewController *detailViewController; + NSArray *controllerNames; + NSIndexPath *lastIndexPath; + GeneralSettingsViewController *generalSettingsViewController; + TeamSettingsViewController *teamSettingsViewController; + WeaponSettingsViewController *weaponSettingsViewController; + SchemeSettingsViewController *schemeSettingsViewController; +} + +@property (nonatomic, retain) DetailViewController *detailViewController; +@property (nonatomic, retain) NSArray *controllerNames; +@property (nonatomic, retain) NSIndexPath *lastIndexPath; + +-(IBAction) dismissSplitView; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/MasterViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MasterViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,155 @@ +// +// MasterViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "MasterViewController.h" +#import "DetailViewController.h" +#import "GeneralSettingsViewController.h" +#import "TeamSettingsViewController.h" +#import "WeaponSettingsViewController.h" +#import "SchemeSettingsViewController.h" +#import "CommodityFunctions.h" + +@implementation MasterViewController +@synthesize detailViewController, controllerNames, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + // the list of selectable controllers + controllerNames = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), + NSLocalizedString(@"Teams",@""), + NSLocalizedString(@"Weapons",@""), + NSLocalizedString(@"Schemes",@""), + nil]; + // the "Done" button on top left + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + target:self + action:@selector(dismissSplitView)]; +} + +#pragma mark - +#pragma mark Table view data source + +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [controllerNames count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]]; + } + + return cell; +} + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + UIViewController *nextController = nil; + + if (newRow != oldRow) { + [self.tableView deselectRowAtIndexPath:lastIndexPath animated:YES]; + [detailViewController.navigationController popToRootViewControllerAnimated:NO]; + + switch (newRow) { + case 0: + if (nil == generalSettingsViewController) + generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = generalSettingsViewController; + break; + case 1: + if (nil == teamSettingsViewController) + teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = teamSettingsViewController; + break; + case 2: + if (nil == weaponSettingsViewController) + weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = weaponSettingsViewController; + break; + case 3: + if (nil == schemeSettingsViewController) + schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = schemeSettingsViewController; + break; + } + + nextController.navigationItem.hidesBackButton = YES; + nextController.title = [controllerNames objectAtIndex:newRow]; + [detailViewController.navigationController pushViewController:nextController animated:NO]; + self.lastIndexPath = indexPath; + [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. + if (generalSettingsViewController.view.superview == nil) + generalSettingsViewController = nil; + if (teamSettingsViewController.view.superview == nil) + teamSettingsViewController = nil; + if (weaponSettingsViewController.view.superview == nil) + weaponSettingsViewController = nil; + if (schemeSettingsViewController.view.superview == nil) + schemeSettingsViewController = nil; + MSG_MEMCLEAN(); +} + +-(void) viewDidUnload { + self.detailViewController = nil; + self.controllerNames = nil; + self.lastIndexPath = nil; + generalSettingsViewController = nil; + teamSettingsViewController = nil; + weaponSettingsViewController = nil; + schemeSettingsViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [controllerNames release]; + [detailViewController release]; + [lastIndexPath release]; + [generalSettingsViewController release]; + [teamSettingsViewController release]; + [weaponSettingsViewController release]; + [schemeSettingsViewController release]; + [super dealloc]; +} + +-(IBAction) dismissSplitView { + [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; +} + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/OverlayViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,48 @@ +// +// overlayViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 16/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class PopoverMenuViewController; + +@interface OverlayViewController : UIViewController { + NSTimer *dimTimer; +#if __IPHONE_3_2 + UIPopoverController *popoverController; +#else + id popoverController; +#endif + PopoverMenuViewController *popupMenu; + BOOL isPopoverVisible; + + UITextField *writeChatTextField; + + CGFloat initialDistanceForPinching; + CGPoint gestureStartPoint; +} + +@property (nonatomic,retain) id popoverController; +@property (nonatomic,retain) PopoverMenuViewController *popupMenu; +@property (nonatomic,retain) UITextField *writeChatTextField; + +-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; +-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; +-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; +-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; + +-(IBAction) buttonReleased:(id) sender; +-(IBAction) buttonPressed:(id) sender; + +-(void) showPopover; +-(void) dismissPopover; +-(void) dimOverlay; +-(void) activateOverlay; +-(void) chatAppear; +-(void) chatDisappear; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/OverlayViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,428 @@ +// +// overlayViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 16/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "OverlayViewController.h" +#import "SDL_uikitappdelegate.h" +#import "PascalImports.h" +#import "CGPointUtils.h" +#import "SDL_mouse.h" +#import "SDL_config_iphoneos.h" +#import "PopoverMenuViewController.h" +#import "CommodityFunctions.h" + +#define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] +#define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] + + +@implementation OverlayViewController +@synthesize popoverController, popupMenu, writeChatTextField; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Release any cached data, images, etc that aren't in use. + if (popupMenu.view.superview == nil) + popupMenu = nil; +} + +-(void) didRotate:(NSNotification *)notification { + UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; + CGRect rect = [[UIScreen mainScreen] bounds]; + CGRect usefulRect = CGRectMake(0, 0, rect.size.width, rect.size.height); + UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:12345]; + + [UIView beginAnimations:@"rotation" context:NULL]; + [UIView setAnimationDuration:0.8f]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + switch (orientation) { + case UIDeviceOrientationLandscapeLeft: + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(0)); + self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); + [self chatDisappear]; + HW_setLandscape(YES); + break; + case UIDeviceOrientationLandscapeRight: + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(180)); + self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90)); + [self chatDisappear]; + HW_setLandscape(YES); + break; + case UIDeviceOrientationPortrait: + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(270)); + self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(0)); + [self chatAppear]; + HW_setLandscape(NO); + } + break; + case UIDeviceOrientationPortraitUpsideDown: + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); + self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(180)); + [self chatAppear]; + HW_setLandscape(NO); + } + break; + default: + DLog(@"Unknown rotation status"); + break; + } + self.view.frame = usefulRect; + //sdlView.frame = usefulRect; + [UIView commitAnimations]; +} + +-(void) chatAppear { + if (writeChatTextField == nil) { + writeChatTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 100, 768, [UIFont systemFontSize]+8)]; + writeChatTextField.textColor = [UIColor whiteColor]; + writeChatTextField.backgroundColor = [UIColor blueColor]; + writeChatTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; + writeChatTextField.autocorrectionType = UITextAutocorrectionTypeNo; + writeChatTextField.enablesReturnKeyAutomatically = NO; + writeChatTextField.keyboardAppearance = UIKeyboardAppearanceDefault; + writeChatTextField.keyboardType = UIKeyboardTypeDefault; + writeChatTextField.returnKeyType = UIReturnKeyDefault; + writeChatTextField.secureTextEntry = NO; + [self.view addSubview:writeChatTextField]; + } + writeChatTextField.alpha = 1; + [self activateOverlay]; + [dimTimer setFireDate:HIDING_TIME_NEVER]; +} + +-(void) chatDisappear { + writeChatTextField.alpha = 0; + [writeChatTextField resignFirstResponder]; + [dimTimer setFireDate:HIDING_TIME_DEFAULT]; +} + +-(void) viewDidLoad { + isPopoverVisible = NO; + self.view.alpha = 0; + self.view.center = CGPointMake(self.view.frame.size.height/2.0, self.view.frame.size.width/2.0); + + + dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] + interval:1000 + target:self + selector:@selector(dimOverlay) + userInfo:nil + repeats:YES]; + + // add timer too runloop, otherwise it doesn't work + [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode]; + + // listen for dismissal of the popover (see below) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(dismissPopover) + name:@"dismissPopover" + object:nil]; + + [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(didRotate:) + name:@"UIDeviceOrientationDidChangeNotification" + object:nil]; + + //self.view.transform = CGAffineTransformRotate(self.view.transform, (M_PI/2.0)); + [UIView beginAnimations:@"showing overlay" context:NULL]; + [UIView setAnimationDuration:1]; + self.view.alpha = 1; + [UIView commitAnimations]; +} + +-(void) viewDidUnload { + self.writeChatTextField = nil; + self.popoverController = nil; + self.popupMenu = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [dimTimer invalidate]; + [writeChatTextField release]; + [popupMenu release]; + [popoverController release]; + // dimTimer is autoreleased + [super dealloc]; +} + +// dim the overlay when there's no more input for a certain amount of time +-(IBAction) buttonReleased:(id) sender { + HW_allKeysUp(); + [dimTimer setFireDate:HIDING_TIME_DEFAULT]; +} + +// nice transition for dimming, should be called only by the timer himself +-(void) dimOverlay { + [UIView beginAnimations:@"overlay dim" context:NULL]; + [UIView setAnimationDuration:0.6]; + self.view.alpha = 0.2; + [UIView commitAnimations]; +} + +// set the overlay visible and put off the timer for enough time +-(void) activateOverlay { + self.view.alpha = 1; + [dimTimer setFireDate:HIDING_TIME_NEVER]; +} + +// issue certain action based on the tag of the button +-(IBAction) buttonPressed:(id) sender { + [self activateOverlay]; + if (isPopoverVisible) { + [self dismissPopover]; + } + UIButton *theButton = (UIButton *)sender; + + switch (theButton.tag) { + case 0: + HW_walkLeft(); + break; + case 1: + HW_walkRight(); + break; + case 2: + HW_aimUp(); + break; + case 3: + HW_aimDown(); + break; + case 4: + HW_shoot(); + break; + case 5: + HW_jump(); + break; + case 6: + HW_backjump(); + break; + case 7: + HW_tab(); + break; + case 10: + [self showPopover]; + break; + default: + NSLog(@"Nope"); + break; + } +} + +// present a further check before closing game +-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { + if ([actionSheet cancelButtonIndex] != buttonIndex) + HW_terminate(NO); + else + HW_pause(); +} + +// show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize +// on iphone instead just use the tableViewController directly (and implement manually all animations) +-(IBAction) showPopover{ + isPopoverVisible = YES; + CGRect anchorForPopover; + Class popoverControllerClass = NSClassFromString(@"UIPopoverController"); + if (popoverControllerClass) { +#if __IPHONE_3_2 + if (popupMenu == nil) + popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStylePlain]; + popoverController = [[popoverControllerClass alloc] initWithContentViewController:popupMenu]; + [popoverController setPopoverContentSize:CGSizeMake(220, 170) animated:YES]; + [popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]]; + + if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) + anchorForPopover = CGRectMake(960, 0, 220, 32); + else + anchorForPopover = CGRectMake(736, 0, 220, 32); + + [popoverController presentPopoverFromRect:anchorForPopover + inView:self.view + permittedArrowDirections:UIPopoverArrowDirectionUp + animated:YES]; +#endif + } else { + if (popupMenu == nil) + popupMenu = [[PopoverMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; + popupMenu.view.backgroundColor = [UIColor clearColor]; + popupMenu.view.frame = CGRectMake(480, 0, 200, 170); + [self.view addSubview:popupMenu.view]; + + [UIView beginAnimations:@"showing popover" context:NULL]; + [UIView setAnimationDuration:0.35]; + popupMenu.view.frame = CGRectMake(280, 0, 200, 170); + [UIView commitAnimations]; + } + popupMenu.tableView.scrollEnabled = NO; +} + +// on ipad just dismiss it, on iphone transtion to the right +-(void) dismissPopover { + if (YES == isPopoverVisible) { + isPopoverVisible = NO; + + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 + [popoverController dismissPopoverAnimated:YES]; +#endif + } else { + [UIView beginAnimations:@"hiding popover" context:NULL]; + [UIView setAnimationDuration:0.35]; + popupMenu.view.frame = CGRectMake(480, 0, 200, 170); + [UIView commitAnimations]; + + [popupMenu.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35]; + [popupMenu performSelector:@selector(release) withObject:nil afterDelay:0.35]; + } + [self buttonReleased:nil]; + } +} + +-(void) textFieldDoneEditing:(id) sender{ + [sender resignFirstResponder]; +} + +#pragma mark - +#pragma mark Custom touch event handling + +#define kMinimumPinchDelta 50 + + +-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + NSArray *twoTouches; + UITouch *touch = [touches anyObject]; + + if (isPopoverVisible) { + [self dismissPopover]; + } + if (writeChatTextField) { + [self.writeChatTextField resignFirstResponder]; + [dimTimer setFireDate:HIDING_TIME_DEFAULT]; + } + + gestureStartPoint = [touch locationInView:self.view]; + + switch ([touches count]) { + case 1: + initialDistanceForPinching = 0; + switch ([touch tapCount]) { + case 1: + NSLog(@"X:%d Y:%d", (int)gestureStartPoint.x, (int)gestureStartPoint.y ); + //SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, + // (int)gestureStartPoint.y, width - (int)gestureStartPoint.x); + //HW_click(); + break; + case 2: + HW_ammoMenu(); + break; + default: + break; + } + break; + case 2: + if (2 == [touch tapCount]) { + HW_zoomReset(); + } + + // pinching + gestureStartPoint.x = 0; + gestureStartPoint.y = 0; + twoTouches = [touches allObjects]; + UITouch *first = [twoTouches objectAtIndex:0]; + UITouch *second = [twoTouches objectAtIndex:1]; + initialDistanceForPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); + break; + default: + break; + } + +} + +-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + initialDistanceForPinching = 0; + HW_allKeysUp(); +} + +-(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { + // this can happen if the user puts more than 5 touches on the screen at once, or perhaps in other circumstances + [self touchesEnded:touches withEvent:event]; +} + +-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { + CGFloat minimumGestureLength; + int logCoeff; + + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { + minimumGestureLength = 5.0f; + logCoeff = 19; + } else { + minimumGestureLength = 3.0f; + logCoeff = 3; + } + + NSArray *twoTouches; + CGPoint currentPosition; + UITouch *touch = [touches anyObject]; + + switch ([touches count]) { + case 1: + currentPosition = [touch locationInView:self.view]; + // panning + CGFloat deltaX = fabsf(gestureStartPoint.x - currentPosition.x); + CGFloat deltaY = fabsf(gestureStartPoint.y - currentPosition.y); + + if (deltaX >= minimumGestureLength) { + NSLog(@"Horizontal swipe detected, deltaX: %f deltaY: %f",deltaX, deltaY); + if (currentPosition.x > gestureStartPoint.x) { + HW_cursorLeft(logCoeff*log(deltaX)); + } else { + HW_cursorRight(logCoeff*log(deltaX)); + } + + } + if (deltaY >= minimumGestureLength) { + NSLog(@"Horizontal swipe detected, deltaX: %f deltaY: %f",deltaX, deltaY); + if (currentPosition.y < gestureStartPoint.y) { + HW_cursorDown(logCoeff*log(deltaY)); + } else { + HW_cursorUp(logCoeff*log(deltaY)); + } + } + + break; + case 2: + twoTouches = [touches allObjects]; + UITouch *first = [twoTouches objectAtIndex:0]; + UITouch *second = [twoTouches objectAtIndex:1]; + CGFloat currentDistanceOfPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); + + if (0 == initialDistanceForPinching) + initialDistanceForPinching = currentDistanceOfPinching; + + if (currentDistanceOfPinching < initialDistanceForPinching + kMinimumPinchDelta) + HW_zoomOut(); + else if (currentDistanceOfPinching > initialDistanceForPinching + kMinimumPinchDelta) + HW_zoomIn(); + + currentDistanceOfPinching = initialDistanceForPinching; + break; + default: + break; + } +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/PopoverMenuViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/PopoverMenuViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,18 @@ +// +// popupMenuViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 25/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface PopoverMenuViewController : UITableViewController { + NSArray *menuList; + BOOL isPaused; +} +@property (nonatomic,retain) NSArray *menuList; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/PopoverMenuViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/PopoverMenuViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,137 @@ + // +// popupMenuViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 25/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SDL_uikitappdelegate.h" +#import "PopoverMenuViewController.h" +#import "PascalImports.h" +#import "CommodityFunctions.h" +#import "SDL_sysvideo.h" + +@implementation PopoverMenuViewController +@synthesize menuList; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; +} + +-(void) viewDidLoad { + isPaused = NO; + + menuList = [[NSArray alloc] initWithObjects: + NSLocalizedString(@"Pause Game", @""), + NSLocalizedString(@"Chat", @""), + NSLocalizedString(@"End Game", @""), + nil]; + [super viewDidLoad]; +} + +-(void) viewDidUnload { + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [menuList release]; + [super dealloc]; +} + +#pragma mark - +#pragma mark tableView methods +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return 3; +} + +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *cellIdentifier = @"CellIdentifier"; + + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; + if (nil == cell) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:cellIdentifier] autorelease]; + } + cell.textLabel.text = [menuList objectAtIndex:[indexPath row]]; + + return cell; +} + +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + UIActionSheet *actionSheet; + + switch ([indexPath row]) { + case 0: + HW_pause(); + isPaused = !isPaused; + break; + case 1: + HW_chat(); + /* + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_VideoDisplay *display = &_this->displays[0]; + SDL_Window *window = display->windows; + SDL_iPhoneKeyboardShow(window); + */ + break; + case 2: + // expand the view (and table) so that the actionsheet can be selected on the iPhone + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { + [self.tableView deselectRowAtIndexPath:indexPath animated:NO]; + [UIView beginAnimations:@"table width more" context:NULL]; + [UIView setAnimationDuration:0.2]; + self.view.frame = CGRectMake(0, 0, 480, 320); + [UIView commitAnimations]; + } + actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") + delegate:self + cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") + destructiveButtonTitle:NSLocalizedString(@"Of course!", @"") + otherButtonTitles:nil]; + [actionSheet showInView:self.view]; + [actionSheet release]; + + if (!isPaused) + HW_pause(); + break; + default: + NSLog(@"Warning: unset case value in section!"); + break; + } + + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +#pragma mark - +#pragma mark actionSheet methods +-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){ + [UIView beginAnimations:@"table width less" context:NULL]; + [UIView setAnimationDuration:0.2]; + self.view.frame = CGRectMake(280, 0, 200, 170); + [UIView commitAnimations]; + } + + if ([actionSheet cancelButtonIndex] != buttonIndex) { + [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissPopover" object:nil]; + HW_terminate(NO); + } + else + if (!isPaused) + HW_pause(); +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,19 @@ +// +// SchemeSettingsViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 19/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import +@class SingleSchemeViewController; + +@interface SchemeSettingsViewController : UITableViewController { + NSMutableArray *listOfSchemes; + SingleSchemeViewController *childController; +} + +@property (nonatomic, retain) NSMutableArray *listOfSchemes; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,162 @@ +// +// SchemeSettingsViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 19/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SchemeSettingsViewController.h" +#import "CommodityFunctions.h" +#import "SingleSchemeViewController.h" + +@implementation SchemeSettingsViewController +@synthesize listOfSchemes; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the scheme panel") + style:UIBarButtonItemStyleBordered + target:self + action:@selector(toggleEdit:)]; + self.navigationItem.rightBarButtonItem = editButton; + [editButton release]; + +} + +-(void) viewWillAppear:(BOOL) animated { + [super viewWillAppear:animated]; + + NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; + self.listOfSchemes = array; + [array release]; + + [self.tableView reloadData]; +} + +// modifies the navigation bar to add the "Add" and "Done" buttons +-(void) toggleEdit:(id) sender { + BOOL isEditing = self.tableView.editing; + [self.tableView setEditing:!isEditing animated:YES]; + + if (isEditing) { + [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the scheme panel")]; + [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered]; + self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem; + } else { + [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Done",@"from the scheme panel")]; + [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone]; + UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Add",@"from the scheme panel") + style:UIBarButtonItemStyleBordered + target:self + action:@selector(addScheme:)]; + self.navigationItem.leftBarButtonItem = addButton; + [addButton release]; + } +} + +-(void) addScheme:(id) sender { + NSString *fileName = [[NSString alloc] initWithFormat:@"Scheme %u.plist", [self.listOfSchemes count]]; + + createSchemeNamed([fileName stringByDeletingPathExtension]); + + [self.listOfSchemes addObject:fileName]; + [fileName release]; + + // order the array alphabetically, so schemes will keep their position + [self.listOfSchemes sortUsingSelector:@selector(compare:)]; + + [self.tableView reloadData]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.listOfSchemes count]; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + NSUInteger row = [indexPath row]; + NSString *rowString = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension]; + cell.textLabel.text = rowString; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + return cell; +} + +// delete the row and the file +-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + NSUInteger row = [indexPath row]; + + NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]]; + [[NSFileManager defaultManager] removeItemAtPath:schemeFile error:NULL]; + [schemeFile release]; + + [self.listOfSchemes removeObjectAtIndex:row]; + [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; +} + +#pragma mark - +#pragma mark Table view delegate + +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (childController == nil) { + childController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped]; + } + + NSInteger row = [indexPath row]; + NSString *selectedSchemeFile = [self.listOfSchemes objectAtIndex:row]; + + // this must be set so childController can load the correct plist + childController.title = [selectedSchemeFile stringByDeletingPathExtension]; + [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; + + [self.navigationController pushViewController:childController animated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + if (childController.view.superview == nil ) + childController = nil; +} + +-(void) viewDidUnload { + self.listOfSchemes = nil; + childController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + + +-(void) dealloc { + [self.listOfSchemes release]; + [childController release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,27 @@ +// +// SchemeWeaponConfigViewController.h +// Hedgewars +// +// Created by Vittorio on 13/06/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface SchemeWeaponConfigViewController : UITableViewController { + NSArray *listOfSchemes; + NSArray *listOfWeapons; + + NSIndexPath *lastIndexPath; + NSString *selectedScheme; + NSString *selectedWeapon; +} + +@property (nonatomic, retain) NSArray *listOfSchemes; +@property (nonatomic, retain) NSArray *listOfWeapons; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; +@property (nonatomic,retain) NSString *selectedScheme; +@property (nonatomic,retain) NSString *selectedWeapon; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,157 @@ +// +// SchemeWeaponConfigViewController.m +// Hedgewars +// +// Created by Vittorio on 13/06/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SchemeWeaponConfigViewController.h" +#import "CommodityFunctions.h" + +@implementation SchemeWeaponConfigViewController +@synthesize listOfSchemes, listOfWeapons, lastIndexPath, selectedScheme, selectedWeapon; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + CGSize screenSize = [[UIScreen mainScreen] bounds].size; + self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); + + self.selectedScheme = @"Default.plist"; + self.selectedWeapon = @"Default.plist"; +} + +-(void) viewWillAppear:(BOOL) animated { + [super viewWillAppear:animated]; + + NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; + self.listOfSchemes = contentsOfDir; + + [self.tableView reloadData]; +} + +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; +} +*/ +/* +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; +} +*/ +/* +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; +} +*/ + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 2; +} + + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 0) + return [self.listOfSchemes count]; + else + return [self.listOfWeapons count]; +} + + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + NSInteger row = [indexPath row]; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + cell.accessoryType = UITableViewCellAccessoryNone; + if ([indexPath section] == 0) { + cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension]; + if ([[self.listOfSchemes objectAtIndex:row] isEqualToString:self.selectedScheme]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } + } else { + cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension]; + if ([[self.listOfWeapons objectAtIndex:row] isEqualToString:self.selectedWeapon]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + //TODO: this code works only for a single section table + UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath]; + newCell.accessoryType = UITableViewCellAccessoryCheckmark; + UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath]; + oldCell.accessoryType = UITableViewCellAccessoryNone; + self.lastIndexPath = indexPath; + self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow]; + [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; +} + +-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger) section { + if (section == 0) { + return NSLocalizedString(@"Schemes",@""); + } else { + return NSLocalizedString(@"Weapons",@"");; + } +} + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.listOfSchemes = nil; + self.listOfWeapons = nil; + self.lastIndexPath = nil; + self.selectedScheme = nil; + self.selectedWeapon = nil; + MSG_DIDUNLOAD(); +} + + +-(void) dealloc { + [listOfSchemes release]; + [listOfWeapons release]; + [lastIndexPath release]; + [selectedScheme release]; + [selectedWeapon release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SingleSchemeViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,25 @@ +// +// SingleSchemeViewController.h +// Hedgewars +// +// Created by Vittorio on 23/05/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface SingleSchemeViewController : UITableViewController { + UITextField *textFieldBeingEdited; + NSMutableArray *schemeArray; + + NSArray *basicSettingList; + NSArray *gameModifierArray; +} + +@property (nonatomic, retain) UITextField *textFieldBeingEdited; +@property (nonatomic, retain) NSMutableArray *schemeArray; +@property (nonatomic, retain) NSArray *basicSettingList; +@property (nonatomic, retain) NSArray *gameModifierArray; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,321 @@ +// +// SingleSchemeViewController.m +// Hedgewars +// +// Created by Vittorio on 23/05/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SingleSchemeViewController.h" +#import +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation SingleSchemeViewController +@synthesize textFieldBeingEdited, schemeArray, basicSettingList, gameModifierArray; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + NSArray *mods = [[NSArray alloc] initWithObjects: + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Fort Mode",@""),@"title", + NSLocalizedString(@"Defend your fort and destroy the opponents (two team colours max)",@""),@"description", + @"Forts",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Divide Team",@""),@"title", + NSLocalizedString(@"Teams will start on opposite sides of the terrain (two team colours max)",@""),@"description", + @"TeamsDivide",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Solid Land",@""),@"title", + NSLocalizedString(@"Land can not be destroyed",@""),@"description", + @"Solid",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Border",@""),@"title", + NSLocalizedString(@"Add an indestructable border around the terrain",@""),@"description", + @"Border",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Low Gravity",@""),@"title", + NSLocalizedString(@"Lower gravity",@""),@"description", + @"LowGravity",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Laser Sight",@""),@"title", + NSLocalizedString(@"Assisted aiming with laser sight",@""),@"description", + @"LaserSight",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Invulnerable",@""),@"title", + NSLocalizedString(@"All hogs have a personal forcefield",@""),@"description", + @"Invulnerable",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Add Mines",@""),@"title", + NSLocalizedString(@"Enable random mines",@""),@"description", + @"Mines",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Vampirism Mode",@""),@"title", + NSLocalizedString(@"Gain 80% of the damage you do back in health",@""),@"description", + @"Vampiric",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Karma Mode",@""),@"title", + NSLocalizedString(@"Share your opponents pain, share their damage",@""),@"description", + @"Karma",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Artillery Mode",@""),@"title", + NSLocalizedString(@"Your hogs are unable to move, test your aim",@""),@"description", + @"Artillery",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Random Order",@""),@"title", + NSLocalizedString(@"Order of play is random instead of in room order",@""),@"description", + @"RandomOrder",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"King Mode",@""),@"title", + NSLocalizedString(@"Play with a King. If he dies, your side loses",@""),@"description", + @"King",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"Place Hedgehogs",@""),@"title", + NSLocalizedString(@"Take turns placing your hedgehogs pre-game",@""),@"description", + @"PlaceHog",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Clan Shares Ammo",@""),@"title", + NSLocalizedString(@"Ammo is shared between all clan teams",@""),@"description", + @"SharedAmmo",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Girders",@""),@"title", + NSLocalizedString(@"Disable girders when generating random maps",@""),@"description", + @"DisableGirders",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Disable Land Objects",@""),@"title", + NSLocalizedString(@"Disable land objects when generating maps",@""),@"description", + @"DisableLandObjects",@"image",nil], + nil]; + self.gameModifierArray = mods; + [mods release]; + + NSArray *basicSettings = [[NSArray alloc] initWithObjects: + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Damage Modifier",@""),@"title",@"Damage",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Turn Time",@""),@"title",@"Time",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Initial Health",@""),@"title",@"Health",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Sudden Death Timeout",@""),@"title",@"SuddenDeath",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Crate Drops",@""),@"title",@"Box",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Time",@""),@"title",@"Time",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Mines Number",@""),@"title",@"Mine",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Dud Mines Probability",@""),@"title",@"Dud",@"image",nil], + [NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Explosives",@""),@"title",@"Damage",@"image",nil], + nil]; + self.basicSettingList = basicSettings; + [basicSettings release]; +} + +// load from file +-(void) viewWillAppear:(BOOL) animated { + [super viewWillAppear:animated]; + + NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title]; + NSMutableArray *scheme = [[NSMutableArray alloc] initWithContentsOfFile:schemeFile]; + self.schemeArray = scheme; + [scheme release]; + [schemeFile release]; + + [self.tableView reloadData]; +} + +// save to file +-(void) viewWillDisappear:(BOOL) animated { + [super viewWillDisappear:animated]; + + NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title]; + [self.schemeArray writeToFile:schemeFile atomically:YES]; + [schemeFile release]; +} + +#pragma mark - +#pragma mark textfield methods +-(void) cancel:(id) sender { + if (textFieldBeingEdited != nil) + [self.textFieldBeingEdited resignFirstResponder]; +} + +// set the new value +-(BOOL) save:(id) sender { + if (textFieldBeingEdited != nil) { + [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title] error:NULL]; + self.title = self.textFieldBeingEdited.text; + [self.schemeArray writeToFile:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.title] atomically:YES]; + [self.textFieldBeingEdited resignFirstResponder]; + return YES; + } + return NO; +} + +// the textfield is being modified, update the navigation controller +-(void) textFieldDidBeginEditing:(UITextField *)aTextField{ + self.textFieldBeingEdited = aTextField; + + UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from schemes table") + style:UIBarButtonItemStylePlain + target:self + action:@selector(cancel:)]; + self.navigationItem.leftBarButtonItem = cancelButton; + [cancelButton release]; + + UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from schemes table") + style:UIBarButtonItemStyleDone + target:self + action:@selector(save:)]; + self.navigationItem.rightBarButtonItem = saveButton; + [saveButton release]; +} + +// the textfield has been modified, check for empty strings and restore original navigation bar +-(void) textFieldDidEndEditing:(UITextField *)aTextField{ + if ([textFieldBeingEdited.text length] == 0) + textFieldBeingEdited.text = [NSString stringWithFormat:@"New Scheme"]; + + self.textFieldBeingEdited = nil; + self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; + self.navigationItem.leftBarButtonItem = nil; +} + +// limit the size of the field to 64 characters like in original frontend +-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + int limit = 64; + return !([textField.text length] > limit && [string length] > range.length); +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + switch (section) { + case 0: + return 1; + break; + case 1: + return [self.basicSettingList count]; + break; + case 2: + return [self.gameModifierArray count]; + default: + break; + } + return 0; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier0 = @"Cell0"; + static NSString *CellIdentifier1 = @"Cell1"; + static NSString *CellIdentifier2 = @"Cell2"; + + UITableViewCell *cell = nil; + NSInteger row = [indexPath row]; + + switch ([indexPath section]) { + case 0: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier0] autorelease]; + // create a uitextfield for each row, expand it to take the maximum size + UITextField *aTextField = [[UITextField alloc] + initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; + aTextField.clearsOnBeginEditing = NO; + aTextField.returnKeyType = UIReturnKeyDone; + aTextField.adjustsFontSizeToFitWidth = YES; + aTextField.delegate = self; + aTextField.tag = [indexPath row]; + aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; + aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; + [cell.contentView addSubview:aTextField]; + [aTextField release]; + } + + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + // we find the uitextfied and we'll use its tag to understand which one is being edited + UITextField *textFieldFound = (UITextField *)oneView; + textFieldFound.text = self.title; + } + } + cell.detailTextLabel.text = nil; + cell.imageView.image = nil; + break; + case 1: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier1] autorelease]; + } + + UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",BTN_DIRECTORY(),[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]]; + cell.imageView.image = [img scaleToSize:CGSizeMake(40, 40)]; + [img release]; + cell.textLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"]; + cell.detailTextLabel.text = nil; + break; + case 2: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle + reuseIdentifier:CellIdentifier2] autorelease]; + UISwitch *onOff = [[UISwitch alloc] init]; + onOff.tag = row; + [onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged]; + cell.accessoryView = onOff; + [onOff release]; + } + + UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",BTN_DIRECTORY(),[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]]; + cell.imageView.image = image; + [image release]; + [cell.imageView.layer setCornerRadius:7.0f]; + [cell.imageView.layer setMasksToBounds:YES]; + cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"]; + cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"]; + [(UISwitch *)cell.accessoryView setOn:[[self.schemeArray objectAtIndex:row] boolValue] animated:NO]; + } + + return cell; +} + +-(void) toggleSwitch:(id) sender { + UISwitch *theSwitch = (UISwitch *)sender; + [self.schemeArray replaceObjectAtIndex:theSwitch.tag withObject:[NSNumber numberWithBool:theSwitch.on]]; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + if ([indexPath section] == 0) { + UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath]; + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + textFieldBeingEdited = (UITextField *)oneView; + [textFieldBeingEdited becomeFirstResponder]; + } + } + } + [aTableView deselectRowAtIndexPath:indexPath animated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +-(void) viewDidUnload { + self.textFieldBeingEdited = nil; + self.schemeArray = nil; + self.basicSettingList = nil; + self.gameModifierArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [textFieldBeingEdited release]; + [schemeArray release]; + [basicSettingList release]; + [gameModifierArray release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SingleTeamViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,44 @@ +// +// SingleTeamViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class HogHatViewController; +@class GravesViewController; +@class VoicesViewController; +@class FortsViewController; +@class FlagsViewController; +@class LevelViewController; +@interface SingleTeamViewController : UITableViewController { + NSMutableDictionary *teamDictionary; + + UITextField *textFieldBeingEdited; + NSString *teamName; + UIImage *normalHogSprite; + + NSArray *secondaryItems; + BOOL isWriteNeeded; + + HogHatViewController *hogHatViewController; + GravesViewController *gravesViewController; + VoicesViewController *voicesViewController; + FortsViewController *fortsViewController; + FlagsViewController *flagsViewController; + LevelViewController *levelViewController; +} + +@property (nonatomic,retain) NSMutableDictionary *teamDictionary; +@property (nonatomic,retain) UITextField *textFieldBeingEdited; +@property (nonatomic,retain) NSString *teamName; +@property (nonatomic,retain) UIImage *normalHogSprite; +@property (nonatomic,retain) NSArray *secondaryItems; + +-(void) writeFile; +-(void) setWriteNeeded; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SingleTeamViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,453 @@ +// +// SingleTeamViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SingleTeamViewController.h" +#import "HogHatViewController.h" +#import "GravesViewController.h" +#import "VoicesViewController.h" +#import "FortsViewController.h" +#import "FlagsViewController.h" +#import "LevelViewController.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +#define TEAMNAME_TAG 1234 + +@implementation SingleTeamViewController +@synthesize teamDictionary, normalHogSprite, secondaryItems, textFieldBeingEdited, teamName; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark textfield methods +-(void) cancel:(id) sender { + if (textFieldBeingEdited != nil) + [self.textFieldBeingEdited resignFirstResponder]; +} + +// set the new value +-(BOOL) save:(id) sender { + NSInteger index = textFieldBeingEdited.tag; + + if (textFieldBeingEdited != nil) { + if (TEAMNAME_TAG == index) { + [self.teamDictionary setObject:textFieldBeingEdited.text forKey:@"teamname"]; + } else { + //replace the old value with the new one + NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:index]; + [hog setObject:textFieldBeingEdited.text forKey:@"hogname"]; + } + + isWriteNeeded = YES; + [self.textFieldBeingEdited resignFirstResponder]; + return YES; + } + return NO; +} + +// the textfield is being modified, update the navigation controller +-(void) textFieldDidBeginEditing:(UITextField *)aTextField{ + self.textFieldBeingEdited = aTextField; + + UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel",@"from the hog name table") + style:UIBarButtonItemStylePlain + target:self + action:@selector(cancel:)]; + self.navigationItem.leftBarButtonItem = cancelButton; + [cancelButton release]; + + UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"from the hog name table") + style:UIBarButtonItemStyleDone + target:self + action:@selector(save:)]; + self.navigationItem.rightBarButtonItem = saveButton; + [saveButton release]; +} + +// the textfield has been modified, check for empty strings and restore original navigation bar +-(void) textFieldDidEndEditing:(UITextField *)aTextField{ + if ([textFieldBeingEdited.text length] == 0) + textFieldBeingEdited.text = [NSString stringWithFormat:@"hedgehog %d",textFieldBeingEdited.tag]; + + self.textFieldBeingEdited = nil; + self.navigationItem.rightBarButtonItem = self.navigationItem.backBarButtonItem; + self.navigationItem.leftBarButtonItem = nil; +} + +// limit the size of the field to 64 characters like in original frontend +-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + int limit = 64; + return !([textField.text length] > limit && [string length] > range.length); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + // labels for the entries + NSArray *array = [[NSArray alloc] initWithObjects: + NSLocalizedString(@"Grave",@""), + NSLocalizedString(@"Voice",@""), + NSLocalizedString(@"Fort",@""), + NSLocalizedString(@"Flag",@""), + NSLocalizedString(@"Level",@""),nil]; + self.secondaryItems = array; + [array release]; + + // load the base hog image, drawing will occure in cellForRow... + NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; + UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; + [normalHogFile release]; + self.normalHogSprite = hogSprite; + [hogSprite release]; + + // listen if any childController modifies the plist and write it if needed + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil]; + isWriteNeeded = NO; +} + +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // load data about the team and write if there has been a change + if (isWriteNeeded) + [self writeFile]; + + NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; + NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile]; + self.teamDictionary = teamDict; + [teamDict release]; + [teamFile release]; + + self.teamName = self.title; + + [self.tableView reloadData]; +} + +// write on file if there has been a change +-(void) viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + + // end the editing of the current field + if (textFieldBeingEdited != nil) { + [self save:nil]; + } + + if (isWriteNeeded) + [self writeFile]; +} + +#pragma mark - +// needed by other classes to warn about a user change +-(void) setWriteNeeded { + isWriteNeeded = YES; +} + +-(void) writeFile { + NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.title]; + + NSString *newTeamName = [self.teamDictionary objectForKey:@"teamname"]; + if (![newTeamName isEqualToString:self.teamName]) { + //delete old + [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL]; + [teamFile release]; + self.title = newTeamName; + self.teamName = newTeamName; + teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),newTeamName]; + } + + [self.teamDictionary writeToFile:teamFile atomically:YES]; + NSLog(@"writing: %@",teamDictionary); + isWriteNeeded = NO; + [teamFile release]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + NSInteger rows = 0; + switch (section) { + case 0: // team name + rows = 1; + break; + case 1: // team members + rows = MAX_HOGS; + break; + case 2: // team details + rows = [self.secondaryItems count]; + break; + default: + break; + } + return rows; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier0 = @"Cell0"; + static NSString *CellIdentifier1 = @"Cell1"; + static NSString *CellIdentifier2 = @"Cell2"; + + NSArray *hogArray; + UITableViewCell *cell = nil; + NSInteger row = [indexPath row]; + UIImage *accessoryImage; + + switch ([indexPath section]) { + case 0: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier0] autorelease]; + // create a uitextfield for each row, expand it to take the maximum size + UITextField *aTextField = [[UITextField alloc] + initWithFrame:CGRectMake(5, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; + aTextField.clearsOnBeginEditing = NO; + aTextField.returnKeyType = UIReturnKeyDone; + aTextField.adjustsFontSizeToFitWidth = YES; + aTextField.delegate = self; + aTextField.tag = [indexPath row]; + aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; + aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; + [cell.contentView addSubview:aTextField]; + [aTextField release]; + } + + cell.imageView.image = nil; + cell.accessoryType = UITableViewCellAccessoryNone; + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + // we find the uitextfied and we'll use its tag to understand which one is being edited + UITextField *textFieldFound = (UITextField *)oneView; + textFieldFound.text = [self.teamDictionary objectForKey:@"teamname"]; + textFieldFound.tag = TEAMNAME_TAG; + } + } + break; + case 1: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier1] autorelease]; + + // create a uitextfield for each row, expand it to take the maximum size + UITextField *aTextField = [[UITextField alloc] + initWithFrame:CGRectMake(42, 12, (cell.frame.size.width + cell.frame.size.width/3) - 42, 25)]; + aTextField.clearsOnBeginEditing = NO; + aTextField.returnKeyType = UIReturnKeyDone; + aTextField.adjustsFontSizeToFitWidth = YES; + aTextField.delegate = self; + aTextField.tag = [indexPath row]; + aTextField.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; + aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + [aTextField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; + [cell.contentView addSubview:aTextField]; + [aTextField release]; + } + + hogArray = [self.teamDictionary objectForKey:@"hedgehogs"]; + + NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@.png", HATS_DIRECTORY(), [[hogArray objectAtIndex:row] objectForKey:@"hat"]]; + UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; + [hatFile release]; + cell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)]; + [hatSprite release]; + + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + // we find the uitextfied and we'll use its tag to understand which one is being edited + UITextField *textFieldFound = (UITextField *)oneView; + textFieldFound.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"]; + } + } + + cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; + break; + case 2: + cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:CellIdentifier2] autorelease]; + } + + cell.textLabel.text = [self.secondaryItems objectAtIndex:row]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + switch (row) { + case 0: // grave + accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", + GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]] + andCutAt:CGRectMake(0,0,32,32)]; + cell.imageView.image = accessoryImage; + [accessoryImage release]; + break; + case 2: // fort + accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@L.png", + FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]]; + cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(42, 42)]; + [accessoryImage release]; + break; + + case 3: // flags + accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", + FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; + cell.imageView.image = accessoryImage; + [accessoryImage release]; + break; + case 4: // level + accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png", + BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"] + objectAtIndex:0] objectForKey:@"level"] + intValue]]]; + cell.imageView.image = accessoryImage; + [accessoryImage release]; + break; + default: + cell.imageView.image = nil; + break; + } + break; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSInteger row = [indexPath row]; + NSInteger section = [indexPath section]; + UITableViewController *nextController = nil; + UITableViewCell *cell; + + if (2 == section) { + switch (row) { + case 0: // grave + if (nil == gravesViewController) + gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped]; + + nextController = gravesViewController; + break; + case 1: // voice + if (nil == voicesViewController) + voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped]; + + nextController = voicesViewController; + break; + case 2: // fort + if (nil == fortsViewController) + fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + + nextController = fortsViewController; + break; + case 3: // flag + if (nil == flagsViewController) + flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + + nextController = flagsViewController; + break; + case 4: // level + if (nil == levelViewController) + levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped]; + + nextController = levelViewController; + break; + } + + nextController.title = [secondaryItems objectAtIndex:row]; + [nextController setTeamDictionary:teamDictionary]; + [self.navigationController pushViewController:nextController animated:YES]; + } else { + cell = [aTableView cellForRowAtIndexPath:indexPath]; + for (UIView *oneView in cell.contentView.subviews) { + if ([oneView isMemberOfClass:[UITextField class]]) { + textFieldBeingEdited = (UITextField *)oneView; + [textFieldBeingEdited becomeFirstResponder]; + } + } + [aTableView deselectRowAtIndexPath:indexPath animated:NO]; + } + +} + +// action to perform when you want to change a hog hat +-(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { + if (nil == hogHatViewController) { + hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped]; + } + + // cache the dictionary file of the team, so that other controllers can modify it + hogHatViewController.teamDictionary = self.teamDictionary; + hogHatViewController.selectedHog = [indexPath row]; + + [self.navigationController pushViewController:hogHatViewController animated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. + if (hogHatViewController.view.superview == nil) + hogHatViewController = nil; + if (gravesViewController.view.superview == nil) + gravesViewController = nil; + if (voicesViewController.view.superview == nil) + voicesViewController = nil; + if (fortsViewController.view.superview == nil) + fortsViewController = nil; + if (flagsViewController.view.superview == nil) + flagsViewController = nil; + if (levelViewController.view.superview == nil) + levelViewController = nil; +} + +-(void) viewDidUnload { + self.teamDictionary = nil; + self.textFieldBeingEdited = nil; + self.teamName = nil; + self.normalHogSprite = nil; + self.secondaryItems = nil; + hogHatViewController = nil; + flagsViewController = nil; + fortsViewController = nil; + gravesViewController = nil; + levelViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [teamDictionary release]; + [textFieldBeingEdited release]; + [teamName release]; + [normalHogSprite release]; + [secondaryItems release]; + [hogHatViewController release]; + [fortsViewController release]; + [gravesViewController release]; + [flagsViewController release]; + [levelViewController release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SplitViewRootController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SplitViewRootController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,16 @@ +// +// SplitViewRootController.h +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +@class DetailViewController; +@interface SplitViewRootController: UIViewController { + DetailViewController *detailViewController; +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/SplitViewRootController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SplitViewRootController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,106 @@ + // +// SplitViewRootController.m +// HedgewarsMobile +// +// Created by Vittorio on 27/03/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SplitViewRootController.h" +#import "MasterViewController.h" +#import "DetailViewController.h" +#import "CommodityFunctions.h" + +@implementation SplitViewRootController + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Release any cached data, images, etc that aren't in use. + if (detailViewController.view.superview == nil) + detailViewController = nil; + MSG_MEMCLEAN(); +} + +// load the view programmatically; we need a splitViewController that handles a MasterViewController +// (which is just a UITableViewController) and a DetailViewController where we present options +-(void) viewDidLoad { + detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; + UINavigationController *detailedNavController = [[UINavigationController alloc] initWithRootViewController:detailViewController]; + [detailViewController release]; + + CGRect rect = [[UIScreen mainScreen] bounds]; + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); + + Class splitViewControllerClass = NSClassFromString(@"UISplitViewController"); + if (splitViewControllerClass) { +#if __IPHONE_3_2 + UISplitViewController *splitViewRootController = [[UISplitViewController alloc] init]; + //splitViewRootController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + splitViewRootController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); + + MasterViewController *masterViewController = [[MasterViewController alloc] initWithStyle:UITableViewStylePlain]; + UINavigationController *mainNavController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; + [masterViewController release]; + + splitViewRootController.delegate = detailViewController; + masterViewController.detailViewController = detailViewController; + splitViewRootController.viewControllers = [NSArray arrayWithObjects: mainNavController, detailedNavController, nil]; + [mainNavController release]; + [detailedNavController release]; + + // add view to main controller + [self.view addSubview:splitViewRootController.view]; +#endif + } else { + [self.view addSubview:detailedNavController.view]; + } + + [super viewDidLoad]; +} + +-(void) viewDidUnload { + detailViewController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [detailViewController release]; + [super dealloc]; +} +-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ + [detailViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; +} + +#pragma mark - +#pragma mark additional methods as we're using a UINavigationController programmatically +// see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/ +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [detailViewController.navigationController viewWillAppear:animated]; +} + +-(void) viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [detailViewController.navigationController viewWillDisappear:animated]; +} + +-(void) viewDidAppear:(BOOL)animated { + [super viewDidLoad]; + [detailViewController.navigationController viewDidAppear:animated]; +} + +-(void) viewDidDisappear:(BOOL)animated { + [super viewDidUnload]; + [detailViewController.navigationController viewDidDisappear:animated]; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/TeamConfigViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,20 @@ +// +// TeamConfigViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface TeamConfigViewController : UITableViewController { + NSMutableArray *listOfTeams; + NSMutableArray *listOfSelectedTeams; +} + +@property (nonatomic, retain) NSMutableArray *listOfTeams; +@property (nonatomic, retain) NSMutableArray *listOfSelectedTeams; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/TeamConfigViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,174 @@ +// +// TeamConfigViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "TeamConfigViewController.h" +#import "CommodityFunctions.h" +#import "HogButtonView.h" +#import "SquareButtonView.h" + +@implementation TeamConfigViewController +@synthesize listOfTeams, listOfSelectedTeams; + +#define NUMBERBUTTON_TAG 123456 +#define SQUAREBUTTON_TAG 654321 +#define LABEL_TAG 456123 + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + [super viewDidLoad]; + + CGSize screenSize = [[UIScreen mainScreen] bounds].size; + self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); +} + +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // integer representation of various color (defined in SquareButtonView) + NSUInteger colors[6] = { 4421353, 4100897, 10632635, 16749353, 14483456, 7566195 }; + NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; + NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]]; + for (int i = 0; i < [contentsOfDir count]; i++) { + NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: + [contentsOfDir objectAtIndex:i],@"team", + [NSNumber numberWithInt:4],@"number", + [NSNumber numberWithInt:colors[i%6]],@"color",nil]; + [array addObject:dict]; + [dict release]; + } + self.listOfTeams = array; + [array release]; + + NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil]; + self.listOfSelectedTeams = emptyArray; + [emptyArray release]; + + [self.tableView reloadData]; +} + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 2; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 0) + return [listOfSelectedTeams count] ; + else + return [listOfTeams count]; +} + +-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section { + if (section == 0) + return NSLocalizedString(@"Playing Teams",@""); + else + return NSLocalizedString(@"Available Teams",@""); +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier0 = @"Cell0"; + static NSString *CellIdentifier1 = @"Cell1"; + NSInteger section = [indexPath section]; + UITableViewCell *cell; + + if (section == 0) { + cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; + + UIButton *numberButton = [[HogButtonView alloc] initWithFrame:CGRectMake(12, 5, 88, 32)]; + numberButton.tag = NUMBERBUTTON_TAG; + [cell addSubview:numberButton]; + [numberButton release]; + + SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(12+88+7, 5, 36, 36)]; + squareButton.tag = SQUAREBUTTON_TAG; + [cell addSubview:squareButton]; + [squareButton release]; + + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+7+36+7, 10, 250, 25)]; + label.textAlignment = UITextAlignmentLeft; + label.backgroundColor = [UIColor clearColor]; + label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize] + 2]; + label.tag = LABEL_TAG; + [cell.contentView addSubview:label]; + [label release]; + } + + NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]]; + + UILabel *cellLabel = (UILabel *)[cell viewWithTag:LABEL_TAG]; + cellLabel.text = [[selectedRow objectForKey:@"team"] stringByDeletingPathExtension]; + + HogButtonView *numberButton = (HogButtonView *)[cell viewWithTag:NUMBERBUTTON_TAG]; + [numberButton drawManyHogs:[[selectedRow objectForKey:@"number"] intValue]]; + numberButton.ownerDictionary = selectedRow; + + SquareButtonView *squareButton = (SquareButtonView *)[cell viewWithTag:SQUAREBUTTON_TAG]; + [squareButton selectColor:[[selectedRow objectForKey:@"color"] intValue]]; + squareButton.ownerDictionary = selectedRow; + } else { + cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; + + cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSInteger row = [indexPath row]; + NSInteger section = [indexPath section]; + + if (section == 0) { + [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; + [self.listOfSelectedTeams removeObjectAtIndex:row]; + } else { + [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]]; + [self.listOfTeams removeObjectAtIndex:row]; + } + [aTableView reloadData]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + self.listOfTeams = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + + +-(void) dealloc { + [self.listOfTeams release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,19 @@ +// +// TeamSettingsViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import +@class SingleTeamViewController; + +@interface TeamSettingsViewController : UITableViewController { + NSMutableArray *listOfTeams; + SingleTeamViewController *childController; +} + +@property (nonatomic, retain) NSMutableArray *listOfTeams; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,167 @@ +// +// TeamSettingsViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "TeamSettingsViewController.h" +#import "SingleTeamViewController.h" +#import "CommodityFunctions.h" + +@implementation TeamSettingsViewController +@synthesize listOfTeams; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +// add an edit button +-(void) viewDidLoad { + [super viewDidLoad]; + + UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"from the team panel") + style:UIBarButtonItemStyleBordered + target:self + action:@selector(toggleEdit:)]; + self.navigationItem.rightBarButtonItem = editButton; + [editButton release]; +} + +// load the list of teams in the teams directory +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; + self.listOfTeams = array; + [array release]; + + [self.tableView reloadData]; +} + +// modifies the navigation bar to add the "Add" and "Done" buttons +-(void) toggleEdit:(id) sender { + BOOL isEditing = self.tableView.editing; + [self.tableView setEditing:!isEditing animated:YES]; + + if (isEditing) { + [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Edit",@"from the team panel")]; + [self.navigationItem.rightBarButtonItem setStyle: UIBarButtonItemStyleBordered]; + self.navigationItem.leftBarButtonItem = self.navigationItem.backBarButtonItem; + } else { + [self.navigationItem.rightBarButtonItem setTitle:NSLocalizedString(@"Done",@"from the team panel")]; + [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone]; + UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Add",@"from the team panel") + style:UIBarButtonItemStyleBordered + target:self + action:@selector(addTeam:)]; + self.navigationItem.leftBarButtonItem = addButton; + [addButton release]; + } +} + +// add a team file with default values and updates the table +-(void) addTeam:(id) sender { + NSString *fileName = [[NSString alloc] initWithFormat:@"Default Team %u.plist", [self.listOfTeams count]]; + + createTeamNamed([fileName stringByDeletingPathExtension]); + + [self.listOfTeams addObject:fileName]; + [fileName release]; + + // order the array alphabetically, so teams will keep their position + [self.listOfTeams sortUsingSelector:@selector(compare:)]; + + [self.tableView reloadData]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.listOfTeams count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + NSUInteger row = [indexPath row]; + NSString *rowString = [[self.listOfTeams objectAtIndex:row] stringByDeletingPathExtension]; + cell.textLabel.text = rowString; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + return cell; +} + +// delete the row and the file +-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + NSUInteger row = [indexPath row]; + + NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[self.listOfTeams objectAtIndex:row]]; + [[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL]; + [teamFile release]; + + [self.listOfTeams removeObjectAtIndex:row]; + [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (childController == nil) { + childController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped]; + } + + NSInteger row = [indexPath row]; + NSString *selectedTeamFile = [listOfTeams objectAtIndex:row]; + + // this must be set so childController can load the correct plist + childController.title = [selectedTeamFile stringByDeletingPathExtension]; + [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; + + [self.navigationController pushViewController:childController animated:YES]; +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. + if (childController.view.superview == nil ) + childController = nil; +} + +-(void) viewDidUnload { + self.listOfTeams = nil; + childController = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [self.listOfTeams release]; + [childController release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/VoicesViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,25 @@ +// +// VoicesViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface VoicesViewController : UITableViewController { + NSMutableDictionary *teamDictionary; + + NSArray *voiceArray; + NSIndexPath *lastIndexPath; + + int voiceBeingPlayed; +} + +@property (nonatomic,retain) NSMutableDictionary *teamDictionary; +@property (nonatomic,retain) NSArray *voiceArray; +@property (nonatomic,retain) NSIndexPath *lastIndexPath; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/VoicesViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,155 @@ +// +// VoicesViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 02/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "VoicesViewController.h" +#import "CommodityFunctions.h" +#import "openalbridge.h" + + +@implementation VoicesViewController +@synthesize teamDictionary, voiceArray, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +- (void)viewDidLoad { + [super viewDidLoad]; + srandom(time(NULL)); + + openal_init(20); +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + // this moves the tableview to the top + [self.tableView setContentOffset:CGPointMake(0,0) animated:NO]; + voiceBeingPlayed = -1; + + // load all the voices names and store them into voiceArray + NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL]; + self.voiceArray = array; +} + +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; +} +*/ + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + if(voiceBeingPlayed >= 0) { + openal_stopsound(voiceBeingPlayed); + voiceBeingPlayed = -1; + } +} + + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.voiceArray count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + NSString *voice = [[voiceArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; + cell.textLabel.text = voice; + + if ([voice isEqualToString:[teamDictionary objectForKey:@"voicepack"]]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + self.lastIndexPath = indexPath; + } else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + + return cell; +} + + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + + if (newRow != oldRow) { + [teamDictionary setObject:[voiceArray objectAtIndex:newRow] forKey:@"voicepack"]; + + // tell our boss to write this new stuff on disk + [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; + [self.tableView reloadData]; + + self.lastIndexPath = indexPath; + [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + } + [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; + + if (voiceBeingPlayed >= 0) { + openal_stopsound(voiceBeingPlayed); + voiceBeingPlayed = -1; + } + + // the keyword static prevents re-initialization of the variable + NSString *voiceDir = [[NSString alloc] initWithFormat:@"%@/%@/",VOICES_DIRECTORY(),[voiceArray objectAtIndex:newRow]]; + NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:voiceDir error:NULL]; + + int index = random() % [array count]; + + voiceBeingPlayed = openal_loadfile([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]); + [voiceDir release]; + openal_playsound(voiceBeingPlayed); +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +-(void) viewDidUnload { + openal_close(); + voiceBeingPlayed = -1; + self.lastIndexPath = nil; + self.teamDictionary = nil; + self.voiceArray = nil; + [super viewDidUnload]; + MSG_DIDUNLOAD(); +} + +-(void) dealloc { + [voiceArray release]; + [teamDictionary release]; + [lastIndexPath release]; + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,16 @@ +// +// WeaponSettingsViewController.h +// HedgewarsMobile +// +// Created by Vittorio on 19/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface WeaponSettingsViewController : UITableViewController { + +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,179 @@ +// +// WeaponSettingsViewController.m +// HedgewarsMobile +// +// Created by Vittorio on 19/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "WeaponSettingsViewController.h" + + +@implementation WeaponSettingsViewController + + +#pragma mark - +#pragma mark Initialization + +/* +- (id)initWithStyle:(UITableViewStyle)style { + // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. + if ((self = [super initWithStyle:style])) { + } + return self; +} +*/ + + +#pragma mark - +#pragma mark View lifecycle + +/* +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} +*/ + +/* +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; +} +*/ +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; +} +*/ +/* +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; +} +*/ +/* +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; +} +*/ + + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Override to allow orientations other than the default portrait orientation. + return YES; +} + + +#pragma mark - +#pragma mark Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + // Return the number of sections. + return 1; +} + + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + // Return the number of rows in the section. + return 1; +} + + +// Customize the appearance of table view cells. +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + + // Configure the cell... + + return cell; +} + + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + + +#pragma mark - +#pragma mark Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // Navigation logic may go here. Create and push another view controller. + /* + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; + // ... + // Pass the selected object to the new view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; + [detailViewController release]; + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Relinquish ownership any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. + // For example: self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/CGPointUtils.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/CGPointUtils.c Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,34 @@ +/* + * CGPointUtils.c + * PinchMe + * + * Created by Jeff LaMarche on 8/2/08. + * Copyright 2008 __MyCompanyName__. All rights reserved. + * + */ + +#include "CGPointUtils.h" +#include + + +CGFloat distanceBetweenPoints (CGPoint first, CGPoint second) { + CGFloat deltaX = second.x - first.x; + CGFloat deltaY = second.y - first.y; + return sqrt(deltaX*deltaX + deltaY*deltaY ); +} + +CGFloat angleBetweenPoints(CGPoint first, CGPoint second) { + CGFloat height = second.y - first.y; + CGFloat width = first.x - second.x; + CGFloat rads = atan(height/width); + return radiansToDegrees(rads); +} + +CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End) { + CGFloat a = line1End.x - line1Start.x; + CGFloat b = line1End.y - line1Start.y; + CGFloat c = line2End.x - line2Start.x; + CGFloat d = line2End.y - line2Start.y; + CGFloat rads = acos(((a*c) + (b*d)) / ((sqrt(a*a + b*b)) * (sqrt(c*c + d*d)))); + return radiansToDegrees(rads); +} diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/CGPointUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/CGPointUtils.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,17 @@ +/* + * CGPointUtils.h + * PinchMe + * + * Created by Jeff LaMarche on 8/2/08. + * Copyright 2008 __MyCompanyName__. All rights reserved. + * + */ + +#import + +#define degreesToRadian(x) (M_PI * x / 180.0) +#define radiansToDegrees(x) (180.0 * x / M_PI) + +CGFloat distanceBetweenPoints (CGPoint first, CGPoint second); +CGFloat angleBetweenPoints(CGPoint first, CGPoint second); +CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint lin2End); diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/CommodityFunctions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/CommodityFunctions.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,46 @@ +// +// CommodityFunctions.h +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + +#define MAX_HOGS 8 + + +#define SETTINGS_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ + objectAtIndex:0] stringByAppendingString:@"/settings.plist"] +#define GAMECONFIG_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ + objectAtIndex:0] stringByAppendingString:@"/gameconfig.plist"] +#define DEBUG_FILE() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ + objectAtIndex:0] stringByAppendingString:@"/debug.txt"] + +#define TEAMS_DIRECTORY() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ + objectAtIndex:0] stringByAppendingString:@"/Teams/"] +#define SCHEMES_DIRECTORY() [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) \ + objectAtIndex:0] stringByAppendingString:@"/Schemes/"] + +#define GRAPHICS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/"] +#define HATS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"] +#define GRAVES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Graves/"] +#define BOTLEVELS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hedgehog/botlevels"] +#define BTN_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Btn"] +#define FLAGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Flags/"] +#define FORTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Forts/"] +#define THEMES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Themes/"] +#define MAPS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"] +#define VOICES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"] + +#define MSG_MEMCLEAN() DLog(@"has cleaned up some memory"); print_free_memory() +#define MSG_DIDUNLOAD() DLog(@"did unload"); + +void createTeamNamed (NSString *nameWithoutExt); +void createSchemeNamed (NSString *nameWithoutExt); +BOOL rotationManager (UIInterfaceOrientation interfaceOrientation); +NSInteger randomPort (); +void popError (const char *title, const char *message); +void print_free_memory (); + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/CommodityFunctions.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/CommodityFunctions.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,137 @@ +// +// CommodityFunctions.m +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "CommodityFunctions.h" +#import +#import + +void createTeamNamed (NSString *nameWithoutExt) { + NSString *teamsDirectory = TEAMS_DIRECTORY(); + + if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { + [[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory + withIntermediateDirectories:NO + attributes:nil + error:NULL]; + } + + NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: MAX_HOGS]; + + for (int i = 0; i < MAX_HOGS; i++) { + NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; + NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:0],@"level", + hogName,@"hogname", @"NoHat",@"hat", nil]; + [hogName release]; + [hedgehogs addObject:hog]; + [hog release]; + } + + NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"0",@"hash", nameWithoutExt,@"teamname", + @"Statue",@"grave", @"Plane",@"fort", @"Default",@"voicepack", + @"hedgewars",@"flag", hedgehogs,@"hedgehogs", nil]; + [hedgehogs release]; + + NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt]; + + [theTeam writeToFile:teamFile atomically:YES]; + [teamFile release]; + [theTeam release]; +} + +void createSchemeNamed (NSString *nameWithoutExt) { + NSString *schemesDirectory = SCHEMES_DIRECTORY(); + + if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { + [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory + withIntermediateDirectories:NO + attributes:nil + error:NULL]; + } + + NSArray *theScheme = [[NSArray alloc] initWithObjects: + [NSNumber numberWithBool:NO], //fortmode + [NSNumber numberWithBool:NO], //divideteam + [NSNumber numberWithBool:NO], //solidland + [NSNumber numberWithBool:NO], //addborder + [NSNumber numberWithBool:NO], //lowgravity + [NSNumber numberWithBool:NO], //lasersight + [NSNumber numberWithBool:NO], //invulnerable + [NSNumber numberWithBool:NO], //addmines + [NSNumber numberWithBool:NO], //vampirism + [NSNumber numberWithBool:NO], //karma + [NSNumber numberWithBool:NO], //artillery + [NSNumber numberWithBool:YES], //randomorder + [NSNumber numberWithBool:NO], //king + [NSNumber numberWithBool:NO], //placehedgehogs + [NSNumber numberWithBool:NO], //clansharesammo + [NSNumber numberWithBool:NO], //disablegirders + [NSNumber numberWithBool:NO], //disablelandobjects + [NSNumber numberWithInt:100], //damagemodifier + [NSNumber numberWithInt:45], //turntime + [NSNumber numberWithInt:100], //initialhealth + [NSNumber numberWithInt:15], //suddendeathtimeout + [NSNumber numberWithInt:5], //cratedrops + [NSNumber numberWithInt:3], //minestime + [NSNumber numberWithInt:4], //mines + [NSNumber numberWithInt:0], //dudmines + [NSNumber numberWithInt:2], //explosives + nil]; + + NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; + + [theScheme writeToFile:schemeFile atomically:YES]; + [schemeFile release]; + [theScheme release]; +} + +BOOL rotationManager (UIInterfaceOrientation interfaceOrientation) { + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + return YES; + else + return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || + (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); +} + +NSInteger randomPort () { + srandom(time(NULL)); + return (random() % 64511) + 1024; +} + +void popError (const char *title, const char *message) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String:title] + message:[NSString stringWithUTF8String:message] + delegate:nil + cancelButtonTitle:@"Ok" + otherButtonTitles:nil]; + [alert show]; + [alert release]; +} + +// by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html +void print_free_memory () { + mach_port_t host_port; + mach_msg_type_number_t host_size; + vm_size_t pagesize; + + host_port = mach_host_self(); + host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); + host_page_size(host_port, &pagesize); + + vm_statistics_data_t vm_stat; + + if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) + DLog(@"Failed to fetch vm statistics"); + + /* Stats in bytes */ + natural_t mem_used = (vm_stat.active_count + + vm_stat.inactive_count + + vm_stat.wire_count) * pagesize; + natural_t mem_free = vm_stat.free_count * pagesize; + natural_t mem_total = mem_used + mem_free; + DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total); +} diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/HogButtonView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/HogButtonView.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,25 @@ +// +// HogButtonView.h +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface HogButtonView : UIButton { + NSInteger numberOfHogs; + UIImage *singleHog; + NSMutableDictionary *ownerDictionary; +} + +@property (nonatomic,retain) UIImage *singleHog; +@property (nonatomic) NSInteger numberOfHogs; +@property (nonatomic,retain) NSMutableDictionary *ownerDictionary; + +-(void) drawManyHogs:(NSInteger) hogs; +-(void) addOne; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/HogButtonView.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/HogButtonView.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,67 @@ +// +// HogButtonView.m +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "HogButtonView.h" +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation HogButtonView +@synthesize singleHog, numberOfHogs, ownerDictionary; + +-(id) initWithFrame:(CGRect)frame { + if ((self = [super initWithFrame:frame])) { + self.backgroundColor = [UIColor clearColor]; + + NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; + UIImage *normalHogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)]; + [normalHogFile release]; + + self.singleHog = normalHogSprite; + [normalHogSprite release]; + [self addTarget:self action:@selector(addOne) forControlEvents:UIControlEventTouchUpInside]; + } + return self; +} + +-(void) addOne { + self.highlighted = NO; + NSInteger number = self.numberOfHogs; + number++; + [self drawManyHogs:number]; +} + +-(void) drawManyHogs:(NSInteger) hogs { + if (numberOfHogs != hogs) { + if (hogs <= MAX_HOGS && hogs >= 1) + numberOfHogs = hogs; + else { + if (hogs > MAX_HOGS) + numberOfHogs = 1; + else + numberOfHogs = MAX_HOGS; + } + [ownerDictionary setObject:[NSNumber numberWithInt:numberOfHogs] forKey:@"number"]; + + UIImage *teamHogs = [[[UIImage alloc] init] autorelease]; + for (int i = 0; i < numberOfHogs; i++) { + teamHogs = [singleHog mergeWith:teamHogs + atPoint:CGPointMake(8, 0) + atSize:CGSizeMake(88, 32)]; + } + [self setImage:teamHogs forState:UIControlStateNormal]; + } +} + +-(void) dealloc { + [ownerDictionary release]; + [singleHog release]; + [super dealloc]; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/PascalImports.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/PascalImports.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,59 @@ +/* + * PascalImports.h +// fpciphonedel +// +// Created by Vittorio on 07/01/10. +// Copyright __MyCompanyName__ 2010. All rights reserved. + * + */ + +#ifndef PASCALIMPORTS +#define PASCALIMPORTS + +#ifdef __cplusplus +extern "C" { +#endif + + /* add C declarations below for all exported Pascal functions/procedure + * that you want to use + */ + + void Game(const char *args[]); + void GenLandPreview(); + + + void HW_versionInfo(short int*, char**); + + void HW_click(void); + void HW_zoomIn(void); + void HW_zoomOut(void); + void HW_zoomReset(void); + void HW_ammoMenu(void); + + void HW_allKeysUp(void); + + void HW_walkLeft(void); + void HW_walkRight(void); + void HW_aimUp(void); + void HW_aimDown(void); + void HW_shoot(void); + void HW_jump(void); + void HW_backjump(void); + + void HW_chat(void); + void HW_tab(void); + void HW_pause(void); + + void HW_cursorUp(int); + void HW_cursorDown(int); + void HW_cursorLeft(int); + void HW_cursorRight(int); + + void HW_terminate(BOOL); + + void HW_setLandscape(BOOL); +#ifdef __cplusplus +} +#endif + +#endif diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,44 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#import +#import "SDL_uikitopenglview.h" + +@class MainMenuViewController; +@class OverlayViewController; + +@interface SDLUIKitDelegate:NSObject { + SDL_Window *window; + UIWindow *uiwindow; + MainMenuViewController *mainViewController; + BOOL isInGame; +} + +@property (readwrite, assign) SDL_Window *window; +@property (readwrite, retain) UIWindow *uiwindow; + ++(SDLUIKitDelegate *)sharedAppDelegate; +-(void) startSDLgame; +-(void) displayOverlayLater; + +@end + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/SDL_uikitappdelegate.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,194 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga, mods for Hedgewars by Vittorio Giovara + slouken@libsdl.org, vittorio.giovara@gmail.com +*/ + +#import "SDL_uikitappdelegate.h" +#import "SDL_uikitopenglview.h" +#import "SDL_uikitwindow.h" +#import "SDL_events_c.h" +#import "../SDL_sysvideo.h" +#import "jumphack.h" +#import "SDL_video.h" +#import "GameSetup.h" +#import "PascalImports.h" +#import "MainMenuViewController.h" +#import "OverlayViewController.h" +#import "CommodityFunctions.h" + +#ifdef main +#undef main +#endif + +#define VALGRIND "/opt/valgrind/bin/valgrind" + +int main (int argc, char *argv[]) { +#ifdef VALGRIND_REXEC + // Using the valgrind build config, rexec ourself in valgrind + // from http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html + if (argc < 2 || (argc >= 2 && strcmp(argv[1], "-valgrind") != 0)) + execl(VALGRIND, VALGRIND, "--leak-check=full", argv[0], "-valgrind", NULL); +#endif + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"SDLUIKitDelegate"); + [pool release]; + return retVal; +} + +@implementation SDLUIKitDelegate +@synthesize uiwindow, window; + +// convenience method ++(SDLUIKitDelegate *)sharedAppDelegate { + // the delegate is set in UIApplicationMain(), which is guaranteed to be called before this method + return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate]; +} + +-(id) init { + if (self = [super init]){ + mainViewController = nil; + isInGame = NO; + self.uiwindow = nil; + self.window = NULL; + } + return self; +} + +-(void) dealloc { + SDL_DestroyWindow(self.window); + [uiwindow release]; + [mainViewController release]; + [super dealloc]; +} + +// main routine for calling the actual game engine +-(IBAction) startSDLgame { + [UIView beginAnimations:@"removing main controller" context:NULL]; + [UIView setAnimationDuration:1]; + mainViewController.view.alpha = 0; + [UIView commitAnimations]; + + // pull out useful configuration info from various files + GameSetup *setup = [[GameSetup alloc] init]; + [setup startThread:@"engineProtocol"]; + const char **gameArgs = [setup getSettings]; + [setup release]; + + // since the sdlwindow is not yet created, we add the overlayController with a delay + [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:1]; + + // this is the pascal fuction that starts the game (wrapped around isInGame) + isInGame = YES; + Game(gameArgs); + isInGame = NO; + + free(gameArgs); + + [UIView beginAnimations:@"inserting main controller" context:NULL]; + [UIView setAnimationDuration:1]; + mainViewController.view.alpha = 1; + [UIView commitAnimations]; +} + +-(void) displayOverlayLater { + // overlay with controls, become visible after 4 seconds, with a transparency effect + OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; + + [[[UIApplication sharedApplication] keyWindow] addSubview:overlayController.view]; + [overlayController release]; +} + +// override the direct execution of SDL_main to allow us to implement the frontend (or even using a nib) +-(void) applicationDidFinishLaunching:(UIApplication *)application { + [application setStatusBarHidden:YES]; + [application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; + + uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + uiwindow.backgroundColor = [UIColor blackColor]; + // needed to keep the app running after a game (gets released in sdl_uikitwindow) + [uiwindow retain]; + + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil]; + else + mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil]; + + [uiwindow addSubview:mainViewController.view]; + [uiwindow makeKeyAndVisible]; + + // Set working directory to resource path + [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; +} + +-(void) applicationWillTerminate:(UIApplication *)application { + SDL_SendQuit(); + if (isInGame) { + HW_terminate(YES); + // hack to prevent automatic termination. See SDL_uikitevents.m for details + longjmp(*(jump_env()), 1); + } +} + +-(void) applicationWillResignActive:(UIApplication *)application { + //NSLog(@"%@", NSStringFromSelector(_cmd)); + if (isInGame) { + HW_pause(); + + /* + // Send every window on every screen a MINIMIZED event. + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (!_this) + return; + + int i; + for (i = 0; i < _this->num_displays; i++) { + const SDL_VideoDisplay *display = &_this->displays[i]; + SDL_Window *window; + for (window = display->windows; window != nil; window = window->next) + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + } + */ + } +} + +-(void) applicationDidBecomeActive:(UIApplication *)application { + //NSLog(@"%@", NSStringFromSelector(_cmd)); + if (isInGame) { + HW_pause(); + + /* + // Send every window on every screen a RESTORED event. + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (!_this) + return; + + int i; + for (i = 0; i < _this->num_displays; i++) { + const SDL_VideoDisplay *display = &_this->displays[i]; + SDL_Window *window; + for (window = display->windows; window != nil; window = window->next) + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } + */ + } +} + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,26 @@ +// +// HogButtonView.h +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface SquareButtonView : UIButton { + NSInteger colorIndex; + NSUInteger selectedColor; + NSArray *colorArray; + NSMutableDictionary *ownerDictionary; +} + +@property (nonatomic,retain) NSArray *colorArray; +@property (nonatomic) NSUInteger selectedColor; +@property (nonatomic,retain) NSMutableDictionary *ownerDictionary; + +-(void) nextColor; +-(void) selectColor:(NSUInteger) color; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/SquareButtonView.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,93 @@ +// +// HogButtonView.m +// HedgewarsMobile +// +// Created by Vittorio on 20/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "SquareButtonView.h" +#import +#import "CommodityFunctions.h" +#import "UIImageExtra.h" + +@implementation SquareButtonView +@synthesize colorArray, selectedColor, ownerDictionary; + +-(id) initWithFrame:(CGRect)frame { + if ((self = [super initWithFrame:frame])) { + colorIndex = -1; + selectedColor = 0; + + // list of allowed colors + NSArray *colors = [[NSArray alloc] initWithObjects: [NSNumber numberWithUnsignedInt:4421353], // bluette + [NSNumber numberWithUnsignedInt:4100897], // greeeen + [NSNumber numberWithUnsignedInt:10632635], // violett + [NSNumber numberWithUnsignedInt:16749353], // oranngy + [NSNumber numberWithUnsignedInt:14483456], // reddish + [NSNumber numberWithUnsignedInt:7566195], // graaaay + nil]; + self.colorArray = colors; + [colors release]; + + // set the color to the first available one + [self nextColor]; + + // this makes the button round and nice + [self.layer setCornerRadius:7.0f]; + [self.layer setMasksToBounds:YES]; + + // this changes the color at button press + [self addTarget:self action:@selector(nextColor) forControlEvents:UIControlEventTouchUpInside]; + + self.backgroundColor = [UIColor blackColor]; + } + return self; +} + +-(void) nextColor { + colorIndex++; + if (colorIndex >= [colorArray count]) + colorIndex = 0; + + NSUInteger color = [[self.colorArray objectAtIndex:colorIndex] unsignedIntValue]; + [self selectColor:color]; + + [ownerDictionary setObject:[NSNumber numberWithInt:color] forKey:@"color"]; +} + +-(void) selectColor:(NSUInteger) color { + if (color != selectedColor) { + selectedColor = color; + + UIGraphicsBeginImageContext(self.frame.size); + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSetRGBFillColor(context, ((color & 0x00FF0000) >> 16)/255.0f, + ((color & 0x0000FF00) >> 8)/255.0f, + (color & 0x000000FF)/255.0f, + 1.0f); + CGContextFillRect(context, CGRectMake(1.1, 1.1, self.frame.size.width-2.2, self.frame.size.height-2.2)); + + UIImageView *resultingImage = [[UIImageView alloc] initWithImage: UIGraphicsGetImageFromCurrentImageContext()]; + UIGraphicsEndImageContext(); + + [self setImage:resultingImage.image forState:UIControlStateNormal]; + [resultingImage release]; + + } + /* + self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f + green:((color & 0x0000FF00) >> 8)/255.0f + blue: (color & 0x000000FF)/255.0f + alpha:1.0f]; + */ +} + +-(void) dealloc { + [ownerDictionary release]; + [colorArray release]; + [super dealloc]; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/UIImageExtra.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/UIImageExtra.h Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,22 @@ +// +// UIImageExtra.h +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface UIImage (extra) + +-(UIImage *)scaleToSize:(CGSize) size; +-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint; +-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize; +-(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect; +-(UIImage *)convertToGrayScale; +-(UIImage *)maskImageWith:(UIImage *)maskImage; +-(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh; + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Classes/otherSrc/UIImageExtra.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/otherSrc/UIImageExtra.m Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,189 @@ +// +// UIImageExtra.m +// HedgewarsMobile +// +// Created by Vittorio on 08/04/10. +// Copyright 2010 __MyCompanyName__. All rights reserved. +// + +#import "UIImageExtra.h" + + +@implementation UIImage (extra) + +-(UIImage *)scaleToSize:(CGSize) size { + // Create a bitmap graphics context + // This will also set it as the current context + UIGraphicsBeginImageContext(size); + + // Draw the scaled image in the current context + [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; + + // Create a new image from current context + UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); + + // Pop the current context from the stack + UIGraphicsEndImageContext(); + + // Return our new scaled image (autoreleased) + return scaledImage; +} + +-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint { + // create a contex of size of the background image + return [self mergeWith:secondImage atPoint:secondImagePoint atSize:self.size]; +} + +-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize { + UIGraphicsBeginImageContext(resultingSize); + + // drav the background image + [self drawAtPoint:CGPointMake(0,0)]; + + // draw the image on top of the first image + [secondImage drawAtPoint:secondImagePoint]; + + // create an image from the current contex (not thread safe) + UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext(); + + // free drawing contex + UIGraphicsEndImageContext(); + + // return the resulting autoreleased image + return resultImage; +} + +-(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect { + // load image from path + UIImage *image = [[UIImage alloc] initWithContentsOfFile: path]; + + if (nil != image) { + // get its CGImage representation with a give size + CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], rect); + + // clean memory + [image release]; + + // create a UIImage from the CGImage (memory must be allocated already) + UIImage *sprite = [self initWithCGImage:cgImgage]; + + // clean memory + CGImageRelease(cgImgage); + + // return resulting image + return sprite; + } else { + NSLog(@"initWithContentsOfFile: andCutAt: FAILED"); + return nil; + } +} + +-(UIImage *)convertToGrayScale { + // Create image rectangle with current image width/height + CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height); + + // Grayscale color space + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); + + // Create bitmap content with current image size and grayscale colorspace + CGContextRef context = CGBitmapContextCreate(nil, self.size.width, self.size.height, 8, 0, colorSpace, kCGImageAlphaNone); + + // Draw image into current context, with specified rectangle + // using previously defined context (with grayscale colorspace) + CGContextDrawImage(context, imageRect, [self CGImage]); + + // Create bitmap image info from pixel data in current context + CGImageRef imageRef = CGBitmapContextCreateImage(context); + + // Create a new UIImage object + UIImage *newImage = [UIImage imageWithCGImage:imageRef]; + + // Release colorspace, context and bitmap information + CGColorSpaceRelease(colorSpace); + CGContextRelease(context); + CFRelease(imageRef); + + // Return the new grayscale image + return newImage; +} + +// by http://iphonedevelopertips.com/cocoa/how-to-mask-an-image.html turned into a category by koda +-(UIImage*) maskImageWith:(UIImage *)maskImage { + CGImageRef maskRef = maskImage.CGImage; + + CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef), + CGImageGetHeight(maskRef), + CGImageGetBitsPerComponent(maskRef), + CGImageGetBitsPerPixel(maskRef), + CGImageGetBytesPerRow(maskRef), + CGImageGetDataProvider(maskRef), NULL, false); + + CGImageRef masked = CGImageCreateWithMask([self CGImage], mask); + + CGImageRelease(mask); + + UIImage* retImage = [UIImage imageWithCGImage:masked]; + + CGImageRelease(masked); + + return retImage; +} + +// by http://blog.sallarp.com/iphone-uiimage-round-corners/ turned into a category by koda +void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth, float ovalHeight) +{ + float fw, fh; + if (ovalWidth == 0 || ovalHeight == 0) { + CGContextAddRect(context, rect); + return; + } + CGContextSaveGState(context); + CGContextTranslateCTM (context, CGRectGetMinX(rect), CGRectGetMinY(rect)); + CGContextScaleCTM (context, ovalWidth, ovalHeight); + fw = CGRectGetWidth (rect) / ovalWidth; + fh = CGRectGetHeight (rect) / ovalHeight; + CGContextMoveToPoint(context, fw, fh/2); + CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); + CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); + CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); + CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); + CGContextClosePath(context); + CGContextRestoreGState(context); +} + +-(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh { + UIImage * newImage = nil; + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + NSInteger cornerWidth = sizewh.width; + NSInteger cornerHeight = sizewh.height; + int w = self.size.width; + int h = self.size.height; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); + + CGContextBeginPath(context); + CGRect rect = CGRectMake(0, 0, w, h); + addRoundedRectToPath(context, rect, cornerWidth, cornerHeight); + CGContextClosePath(context); + CGContextClip(context); + + CGContextDrawImage(context, CGRectMake(0, 0, w, h), self.CGImage); + + CGImageRef imageMasked = CGBitmapContextCreateImage(context); + CGContextRelease(context); + CGColorSpaceRelease(colorSpace); + [self release]; + + newImage = [[UIImage imageWithCGImage:imageMasked] retain]; + CGImageRelease(imageMasked); + + [pool release]; + + return newImage; +} + + +@end diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Jun 17 19:57:51 2010 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Jun 17 20:30:39 2010 +0200 @@ -25,26 +25,80 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; }; 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; }; - 611B0AA1116B626E00112153 /* GeneralSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611B0AA0116B626E00112153 /* GeneralSettingsViewController.m */; }; - 611E127D117BACC60044B62F /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611E127C117BACC60044B62F /* GameConfigViewController-iPad.xib */; }; - 611E127F117BACCD0044B62F /* GameConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611E127E117BACCD0044B62F /* GameConfigViewController-iPhone.xib */; }; 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */ = {isa = PBXBuildFile; fileRef = 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */; }; - 611E1316117BBE5A0044B62F /* WeaponSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611E1315117BBE5A0044B62F /* WeaponSettingsViewController.m */; }; - 611E1319117BBE700044B62F /* SchemeSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611E1318117BBE700044B62F /* SchemeSettingsViewController.m */; }; 611F4D4B11B27A9900F9759A /* uScript.pas in Sources */ = {isa = PBXBuildFile; fileRef = 611F4D4A11B27A9900F9759A /* uScript.pas */; }; 6122CD01116BECCA002648E9 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6122CD00116BECCA002648E9 /* Default-Landscape.png */; }; 61272334117DF764005B90CF /* libSDL_image.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61272333117DF752005B90CF /* libSDL_image.a */; }; 61272339117DF778005B90CF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61272338117DF778005B90CF /* MobileCoreServices.framework */; }; - 61272424117E17CF005B90CF /* TeamConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61272423117E17CF005B90CF /* TeamConfigViewController.m */; }; - 612724D3117E28AF005B90CF /* HogButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 612724D2117E28AF005B90CF /* HogButtonView.m */; }; 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */ = {isa = PBXBuildFile; fileRef = 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */; }; - 61370676117B32EF004EE44A /* GameConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61370674117B32EF004EE44A /* GameConfigViewController.m */; }; 6151347E116C2803001F16D1 /* Icon-iPad.png in Resources */ = {isa = PBXBuildFile; fileRef = 6151347D116C2803001F16D1 /* Icon-iPad.png */; }; - 615134B1116C2C5F001F16D1 /* OverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 615134B0116C2C5F001F16D1 /* OverlayViewController.xib */; }; - 615A92911183E31C006CA772 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 615A92901183E31C006CA772 /* MapConfigViewController-iPhone.xib */; }; - 615FBA5511A93C9800B139F9 /* SingleSchemeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 615FBA5311A93C9800B139F9 /* SingleSchemeViewController.h */; }; - 615FBA5811A93D6700B139F9 /* SingleSchemeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 615FBA5411A93C9800B139F9 /* SingleSchemeViewController.m */; }; - 617814E8118947A200C6A535 /* MapConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 617814E7118947A200C6A535 /* MapConfigViewController-iPad.xib */; }; + 6165920C11CA9BA200D6E256 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591DF11CA9BA200D6E256 /* DetailViewController.m */; }; + 6165920D11CA9BA200D6E256 /* FlagsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591E111CA9BA200D6E256 /* FlagsViewController.m */; }; + 6165920E11CA9BA200D6E256 /* FortsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591E311CA9BA200D6E256 /* FortsViewController.m */; }; + 6165920F11CA9BA200D6E256 /* GameConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591E511CA9BA200D6E256 /* GameConfigViewController.m */; }; + 6165921011CA9BA200D6E256 /* GameSetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591E711CA9BA200D6E256 /* GameSetup.m */; }; + 6165921111CA9BA200D6E256 /* GeneralSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591E911CA9BA200D6E256 /* GeneralSettingsViewController.m */; }; + 6165921211CA9BA200D6E256 /* GravesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591EB11CA9BA200D6E256 /* GravesViewController.m */; }; + 6165921311CA9BA200D6E256 /* HogHatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591ED11CA9BA200D6E256 /* HogHatViewController.m */; }; + 6165921411CA9BA200D6E256 /* LevelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591EF11CA9BA200D6E256 /* LevelViewController.m */; }; + 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F111CA9BA200D6E256 /* MainMenuViewController.m */; }; + 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F311CA9BA200D6E256 /* MapConfigViewController.m */; }; + 6165921711CA9BA200D6E256 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F511CA9BA200D6E256 /* MasterViewController.m */; }; + 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F711CA9BA200D6E256 /* OverlayViewController.m */; }; + 6165921911CA9BA200D6E256 /* PopoverMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F911CA9BA200D6E256 /* PopoverMenuViewController.m */; }; + 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */; }; + 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */; }; + 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */; }; + 6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */; }; + 6165921E11CA9BA200D6E256 /* SplitViewRootController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920311CA9BA200D6E256 /* SplitViewRootController.m */; }; + 6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */; }; + 6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920711CA9BA200D6E256 /* TeamSettingsViewController.m */; }; + 6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920911CA9BA200D6E256 /* VoicesViewController.m */; }; + 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */; }; + 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165922311CA9BD500D6E256 /* CGPointUtils.c */; }; + 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922611CA9BD500D6E256 /* CommodityFunctions.m */; }; + 6165923011CA9BD500D6E256 /* HogButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922811CA9BD500D6E256 /* HogButtonView.m */; }; + 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922B11CA9BD500D6E256 /* SquareButtonView.m */; }; + 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922D11CA9BD500D6E256 /* UIImageExtra.m */; }; + 6165923D11CA9C4600D6E256 /* commands.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165923311CA9C4600D6E256 /* commands.c */; }; + 6165923E11CA9C4600D6E256 /* commands.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923411CA9C4600D6E256 /* commands.h */; }; + 6165923F11CA9C4600D6E256 /* globals.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923511CA9C4600D6E256 /* globals.h */; }; + 6165924011CA9C4600D6E256 /* loaders.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165923611CA9C4600D6E256 /* loaders.c */; }; + 6165924111CA9C4600D6E256 /* loaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923711CA9C4600D6E256 /* loaders.h */; }; + 6165924211CA9C4600D6E256 /* openalbridge_t.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923811CA9C4600D6E256 /* openalbridge_t.h */; }; + 6165924311CA9C4600D6E256 /* openalbridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165923911CA9C4600D6E256 /* openalbridge.c */; }; + 6165924411CA9C4600D6E256 /* openalbridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923A11CA9C4600D6E256 /* openalbridge.h */; }; + 6165924511CA9C4600D6E256 /* wrappers.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165923B11CA9C4600D6E256 /* wrappers.c */; }; + 6165924611CA9C4600D6E256 /* wrappers.h in Headers */ = {isa = PBXBuildFile; fileRef = 6165923C11CA9C4600D6E256 /* wrappers.h */; }; + 6165925111CA9CB400D6E256 /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924911CA9CB400D6E256 /* GameConfigViewController-iPad.xib */; }; + 6165925211CA9CB400D6E256 /* GameConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */; }; + 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */; }; + 6165925411CA9CB400D6E256 /* MainMenuViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */; }; + 6165925511CA9CB400D6E256 /* MapConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */; }; + 6165925611CA9CB400D6E256 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */; }; + 6165925711CA9CB400D6E256 /* OverlayViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924F11CA9CB400D6E256 /* OverlayViewController-iPad.xib */; }; + 6165925811CA9CB400D6E256 /* OverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165925011CA9CB400D6E256 /* OverlayViewController.xib */; }; + 6165925E11CA9CD300D6E256 /* arrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165925911CA9CD300D6E256 /* arrowDown.png */; }; + 6165925F11CA9CD300D6E256 /* arrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165925A11CA9CD300D6E256 /* arrowLeft.png */; }; + 6165926011CA9CD300D6E256 /* arrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165925B11CA9CD300D6E256 /* arrowRight.png */; }; + 6165926111CA9CD300D6E256 /* arrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165925C11CA9CD300D6E256 /* arrowUp.png */; }; + 6165926211CA9CD300D6E256 /* joyPush.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165925D11CA9CD300D6E256 /* joyPush.png */; }; + 6165927411CA9D0E00D6E256 /* backgroundBottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165926D11CA9D0E00D6E256 /* backgroundBottom.png */; }; + 6165927511CA9D0E00D6E256 /* backgroundCenter.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165926E11CA9D0E00D6E256 /* backgroundCenter.png */; }; + 6165927611CA9D0E00D6E256 /* backgroundLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165926F11CA9D0E00D6E256 /* backgroundLeft.png */; }; + 6165927711CA9D0E00D6E256 /* backgroundRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927011CA9D0E00D6E256 /* backgroundRight.png */; }; + 6165927811CA9D0E00D6E256 /* backgroundTop.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927111CA9D0E00D6E256 /* backgroundTop.png */; }; + 6165927911CA9D0E00D6E256 /* borderBottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927211CA9D0E00D6E256 /* borderBottom.png */; }; + 6165927A11CA9D0E00D6E256 /* borderTop.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927311CA9D0E00D6E256 /* borderTop.png */; }; + 6165927F11CA9D3200D6E256 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927B11CA9D3200D6E256 /* Default.png */; }; + 6165928011CA9D3200D6E256 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927C11CA9D3200D6E256 /* Icon.png */; }; + 6165928111CA9D3200D6E256 /* menuCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927D11CA9D3200D6E256 /* menuCorner.png */; }; + 6165928211CA9D3200D6E256 /* title.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165927E11CA9D3200D6E256 /* title.png */; }; + 6165928711CA9D4800D6E256 /* networkButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165928311CA9D4800D6E256 /* networkButton.png */; }; + 6165928811CA9D4800D6E256 /* playButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165928411CA9D4800D6E256 /* playButton.png */; }; + 6165928911CA9D4800D6E256 /* settingsButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165928511CA9D4800D6E256 /* settingsButton.png */; }; + 6165928A11CA9D4800D6E256 /* storeButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6165928611CA9D4800D6E256 /* storeButton.png */; }; + 6165929E11CA9E2F00D6E256 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165929D11CA9E2F00D6E256 /* SDL_uikitappdelegate.m */; }; 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E7114AA34C00BA94A9 /* hwengine.pas */; }; 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E9114AA34C00BA94A9 /* hwLibrary.pas */; }; 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987EC114AA34C00BA94A9 /* PascalExports.pas */; }; @@ -78,10 +132,6 @@ 6179883A114AA34C00BA94A9 /* uTeams.pas in Sources */ = {isa = PBXBuildFile; fileRef = 6179880C114AA34C00BA94A9 /* uTeams.pas */; }; 6179883C114AA34C00BA94A9 /* uVisualGears.pas in Sources */ = {isa = PBXBuildFile; fileRef = 6179880E114AA34C00BA94A9 /* uVisualGears.pas */; }; 6179883D114AA34C00BA94A9 /* uWorld.pas in Sources */ = {isa = PBXBuildFile; fileRef = 6179880F114AA34C00BA94A9 /* uWorld.pas */; }; - 6179885C114AA48A00BA94A9 /* CGPointUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 61798856114AA48A00BA94A9 /* CGPointUtils.c */; }; - 61798869114AA4AA00BA94A9 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 61798864114AA4AA00BA94A9 /* SDL_uikitappdelegate.m */; }; - 6179887D114AA4D000BA94A9 /* MainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6179886F114AA4D000BA94A9 /* MainMenuViewController.m */; }; - 61798889114AA4E600BA94A9 /* GameSetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 61798888114AA4E600BA94A9 /* GameSetup.m */; }; 617988DB114AAA4200BA94A9 /* libSDLiPhoneOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 617988DA114AAA3900BA94A9 /* libSDLiPhoneOS.a */; }; 6179891B114AAF2100BA94A9 /* libfreetype_arm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798916114AAF2100BA94A9 /* libfreetype_arm.a */; }; 6179891C114AAF2100BA94A9 /* libfreetype_x86.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798917114AAF2100BA94A9 /* libfreetype_x86.a */; }; @@ -90,62 +140,15 @@ 61798996114AB3FF00BA94A9 /* libSDL_mixer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798993114AB3FA00BA94A9 /* libSDL_mixer.a */; }; 617989BE114AB47A00BA94A9 /* libSDL_net.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 617989BB114AB47500BA94A9 /* libSDL_net.a */; }; 61798A14114AB65C00BA94A9 /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798A13114AB65600BA94A9 /* libSDL_ttf.a */; }; - 61798A2C114ADD2600BA94A9 /* backgroundBottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A1E114ADD2600BA94A9 /* backgroundBottom.png */; }; - 61798A2D114ADD2600BA94A9 /* backgroundCenter.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A1F114ADD2600BA94A9 /* backgroundCenter.png */; }; - 61798A2E114ADD2600BA94A9 /* backgroundLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A20114ADD2600BA94A9 /* backgroundLeft.png */; }; - 61798A2F114ADD2600BA94A9 /* backgroundRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A21114ADD2600BA94A9 /* backgroundRight.png */; }; - 61798A30114ADD2600BA94A9 /* backgroundTop.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A22114ADD2600BA94A9 /* backgroundTop.png */; }; - 61798A31114ADD2600BA94A9 /* borderBottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A23114ADD2600BA94A9 /* borderBottom.png */; }; - 61798A32114ADD2600BA94A9 /* borderTop.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A24114ADD2600BA94A9 /* borderTop.png */; }; - 61798A33114ADD2600BA94A9 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A25114ADD2600BA94A9 /* Default.png */; }; - 61798A34114ADD2600BA94A9 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A26114ADD2600BA94A9 /* Icon.png */; }; - 61798A35114ADD2600BA94A9 /* networkButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A27114ADD2600BA94A9 /* networkButton.png */; }; - 61798A36114ADD2600BA94A9 /* playButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A28114ADD2600BA94A9 /* playButton.png */; }; - 61798A37114ADD2600BA94A9 /* settingsButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A29114ADD2600BA94A9 /* settingsButton.png */; }; - 61798A38114ADD2600BA94A9 /* storeButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A2A114ADD2600BA94A9 /* storeButton.png */; }; - 61798A39114ADD2600BA94A9 /* title.png in Resources */ = {isa = PBXBuildFile; fileRef = 61798A2B114ADD2600BA94A9 /* title.png */; }; 61799289114AE08700BA94A9 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 61798A5E114AE08600BA94A9 /* Data */; }; - 6179934F114BD5AB00BA94A9 /* menuCorner.png in Resources */ = {isa = PBXBuildFile; fileRef = 6179934E114BD5AB00BA94A9 /* menuCorner.png */; }; - 6179936B11501D3D00BA94A9 /* arrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 6179936711501D3D00BA94A9 /* arrowDown.png */; }; - 6179936C11501D3D00BA94A9 /* arrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 6179936811501D3D00BA94A9 /* arrowLeft.png */; }; - 6179936D11501D3D00BA94A9 /* arrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 6179936911501D3D00BA94A9 /* arrowRight.png */; }; - 6179936E11501D3D00BA94A9 /* arrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 6179936A11501D3D00BA94A9 /* arrowUp.png */; }; - 617995321150403800BA94A9 /* joyPush.png in Resources */ = {isa = PBXBuildFile; fileRef = 617995311150403800BA94A9 /* joyPush.png */; }; - 6184DEA311795DBD00AF6EFA /* UIImageExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 6184DEA211795DBD00AF6EFA /* UIImageExtra.m */; }; - 618BE5931175126900F22556 /* LevelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 618BE5921175126900F22556 /* LevelViewController.m */; }; - 618BE60311751F4F00F22556 /* GravesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 618BE60211751F4F00F22556 /* GravesViewController.m */; }; - 618BE6A3117527CD00F22556 /* VoicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 618BE6A2117527CD00F22556 /* VoicesViewController.m */; }; - 619C51BF116E40FC0049FD84 /* CommodityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 619C51BE116E40FC0049FD84 /* CommodityFunctions.m */; }; - 619C5232116E4E810049FD84 /* FlagsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 619C5231116E4E810049FD84 /* FlagsViewController.m */; }; - 619C533E116E70050049FD84 /* FortsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 619C533D116E70050049FD84 /* FortsViewController.m */; }; 61A1188511683A8C00359010 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A117FE1168322700359010 /* CoreGraphics.framework */; }; - 61A118CA11683C7600359010 /* MainMenuViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61A118C911683C7600359010 /* MainMenuViewController-iPad.xib */; }; - 61A118CC11683C7A00359010 /* MainMenuViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61A118CB11683C7A00359010 /* MainMenuViewController-iPhone.xib */; }; 61A118D211683CD100359010 /* Background.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9C81155A1F200C2203D /* Background.png */; }; 61A118D311683CD100359010 /* HedgewarsTitle.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9CB1155A28C00C2203D /* HedgewarsTitle.png */; }; 61A118D411683CD100359010 /* Multiplayer.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9D11155A41000C2203D /* Multiplayer.png */; }; 61A118D511683CD100359010 /* NetworkPlay.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9CF1155A40700C2203D /* NetworkPlay.png */; }; - 61A11A4E1168D13600359010 /* PopoverMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11A4D1168D13600359010 /* PopoverMenuViewController.m */; }; - 61A11AC91168DA9400359010 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11AC81168DA9400359010 /* MasterViewController.m */; }; - 61A11ACF1168DB1B00359010 /* TeamSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11ACE1168DB1B00359010 /* TeamSettingsViewController.m */; }; - 61A11AD61168DB3700359010 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11AD51168DB3700359010 /* DetailViewController.m */; }; - 61A11AE11168DC6E00359010 /* SingleTeamViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11AE01168DC6E00359010 /* SingleTeamViewController.m */; }; - 61A11AE41168DC9400359010 /* HogHatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11AE31168DC9400359010 /* HogHatViewController.m */; }; - 61AA7ACA117FCC8200FDDD4D /* openalbridge_t.h in Headers */ = {isa = PBXBuildFile; fileRef = 61AA7AC9117FCC8200FDDD4D /* openalbridge_t.h */; }; - 61AE62C711A067FE008DC32E /* SplitViewRootController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A11AC01168D8B600359010 /* SplitViewRootController.m */; }; - 61B22E0F1180FBF400B2FCE0 /* MapConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B22E0D1180FBF400B2FCE0 /* MapConfigViewController.m */; }; - 61C325451179A336001E70B1 /* globals.h in Headers */ = {isa = PBXBuildFile; fileRef = 61C3253B1179A336001E70B1 /* globals.h */; }; - 61C325461179A336001E70B1 /* loaders.c in Sources */ = {isa = PBXBuildFile; fileRef = 61C3253C1179A336001E70B1 /* loaders.c */; }; - 61C325471179A336001E70B1 /* loaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 61C3253D1179A336001E70B1 /* loaders.h */; }; - 61C325481179A336001E70B1 /* openalbridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 61C3253E1179A336001E70B1 /* openalbridge.c */; }; - 61C325491179A336001E70B1 /* openalbridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 61C325401179A336001E70B1 /* openalbridge.h */; }; - 61C3254A1179A336001E70B1 /* wrappers.c in Sources */ = {isa = PBXBuildFile; fileRef = 61C325411179A336001E70B1 /* wrappers.c */; }; - 61C3254B1179A336001E70B1 /* wrappers.h in Headers */ = {isa = PBXBuildFile; fileRef = 61C325421179A336001E70B1 /* wrappers.h */; }; 61C3255B1179A384001E70B1 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61C3255A1179A384001E70B1 /* OpenAL.framework */; }; 61C325901179A732001E70B1 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61C3255A1179A384001E70B1 /* OpenAL.framework */; }; 61C325A31179A7AD001E70B1 /* libopenalbridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61C3251D1179A300001E70B1 /* libopenalbridge.a */; }; - 61CE250D115E749A0098C467 /* OverlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CE250C115E749A0098C467 /* OverlayViewController.m */; }; - 61CF4971117E702F00BF05B7 /* SquareButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CF4970117E702F00BF05B7 /* SquareButtonView.m */; }; 922F64900F10F53100DC6EC0 /* libfpc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 928301170F10CAFC00CC5A3C /* libfpc.a */; }; /* End PBXBuildFile section */ @@ -221,36 +224,114 @@ 28FD14FF0DC6FC520079059D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 28FD15070DC6FC5B0079059D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hedgewars_Prefix.pch; sourceTree = ""; }; - 611B0A9F116B626E00112153 /* GeneralSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeneralSettingsViewController.h; path = ../../cocoaTouch/GeneralSettingsViewController.h; sourceTree = SOURCE_ROOT; }; - 611B0AA0116B626E00112153 /* GeneralSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GeneralSettingsViewController.m; path = ../../cocoaTouch/GeneralSettingsViewController.m; sourceTree = SOURCE_ROOT; }; - 611E127C117BACC60044B62F /* GameConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "GameConfigViewController-iPad.xib"; path = "../../cocoaTouch/xib/GameConfigViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; - 611E127E117BACCD0044B62F /* GameConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "GameConfigViewController-iPhone.xib"; path = "../../cocoaTouch/xib/GameConfigViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Development.plist"; sourceTree = ""; }; - 611E1314117BBE5A0044B62F /* WeaponSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WeaponSettingsViewController.h; path = ../../cocoaTouch/WeaponSettingsViewController.h; sourceTree = SOURCE_ROOT; }; - 611E1315117BBE5A0044B62F /* WeaponSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WeaponSettingsViewController.m; path = ../../cocoaTouch/WeaponSettingsViewController.m; sourceTree = SOURCE_ROOT; }; - 611E1317117BBE700044B62F /* SchemeSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SchemeSettingsViewController.h; path = ../../cocoaTouch/SchemeSettingsViewController.h; sourceTree = SOURCE_ROOT; }; - 611E1318117BBE700044B62F /* SchemeSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SchemeSettingsViewController.m; path = ../../cocoaTouch/SchemeSettingsViewController.m; sourceTree = SOURCE_ROOT; }; 611F4D4A11B27A9900F9759A /* uScript.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uScript.pas; path = ../../hedgewars/uScript.pas; sourceTree = SOURCE_ROOT; }; 611FD9C81155A1F200C2203D /* Background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Background.png; path = ../../QTfrontend/res/Background.png; sourceTree = SOURCE_ROOT; }; 611FD9CB1155A28C00C2203D /* HedgewarsTitle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = HedgewarsTitle.png; path = ../../QTfrontend/res/HedgewarsTitle.png; sourceTree = SOURCE_ROOT; }; 611FD9CF1155A40700C2203D /* NetworkPlay.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = NetworkPlay.png; path = ../../QTfrontend/res/NetworkPlay.png; sourceTree = SOURCE_ROOT; }; 611FD9D11155A41000C2203D /* Multiplayer.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Multiplayer.png; path = ../../QTfrontend/res/Multiplayer.png; sourceTree = SOURCE_ROOT; }; - 6122CD00116BECCA002648E9 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-Landscape.png"; path = "../../cocoaTouch/resources/Default-Landscape.png"; sourceTree = SOURCE_ROOT; }; + 6122CD00116BECCA002648E9 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-Landscape.png"; path = "Resources/Default-Landscape.png"; sourceTree = ""; }; 6127232E117DF752005B90CF /* SDL_image.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_image.xcodeproj; path = "../../../Library/SDL-1.3/SDL_image/Xcode_iPhone/SDL_image.xcodeproj"; sourceTree = SOURCE_ROOT; }; 61272338117DF778005B90CF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; - 61272422117E17CF005B90CF /* TeamConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TeamConfigViewController.h; path = ../../cocoaTouch/TeamConfigViewController.h; sourceTree = SOURCE_ROOT; }; - 61272423117E17CF005B90CF /* TeamConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TeamConfigViewController.m; path = ../../cocoaTouch/TeamConfigViewController.m; sourceTree = SOURCE_ROOT; }; - 612724D1117E28AF005B90CF /* HogButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HogButtonView.h; path = ../../cocoaTouch/otherSrc/HogButtonView.h; sourceTree = SOURCE_ROOT; }; - 612724D2117E28AF005B90CF /* HogButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HogButtonView.m; path = ../../cocoaTouch/otherSrc/HogButtonView.m; sourceTree = SOURCE_ROOT; }; 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Distribution.plist"; sourceTree = ""; }; - 61370673117B32EF004EE44A /* GameConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GameConfigViewController.h; path = ../../cocoaTouch/GameConfigViewController.h; sourceTree = SOURCE_ROOT; }; - 61370674117B32EF004EE44A /* GameConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GameConfigViewController.m; path = ../../cocoaTouch/GameConfigViewController.m; sourceTree = SOURCE_ROOT; }; - 6151347D116C2803001F16D1 /* Icon-iPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-iPad.png"; path = "../../cocoaTouch/resources/Icon-iPad.png"; sourceTree = SOURCE_ROOT; }; - 615134B0116C2C5F001F16D1 /* OverlayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = OverlayViewController.xib; path = ../../cocoaTouch/xib/OverlayViewController.xib; sourceTree = SOURCE_ROOT; }; - 615A92901183E31C006CA772 /* MapConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPhone.xib"; path = "../../cocoaTouch/xib/MapConfigViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; - 615FBA5311A93C9800B139F9 /* SingleSchemeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SingleSchemeViewController.h; path = ../../cocoaTouch/SingleSchemeViewController.h; sourceTree = SOURCE_ROOT; }; - 615FBA5411A93C9800B139F9 /* SingleSchemeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SingleSchemeViewController.m; path = ../../cocoaTouch/SingleSchemeViewController.m; sourceTree = SOURCE_ROOT; }; - 617814E7118947A200C6A535 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPad.xib"; path = "../../cocoaTouch/xib/MapConfigViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; + 6151347D116C2803001F16D1 /* Icon-iPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-iPad.png"; path = "Resources/Icon-iPad.png"; sourceTree = ""; }; + 616591DE11CA9BA200D6E256 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; + 616591DF11CA9BA200D6E256 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; + 616591E011CA9BA200D6E256 /* FlagsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlagsViewController.h; sourceTree = ""; }; + 616591E111CA9BA200D6E256 /* FlagsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlagsViewController.m; sourceTree = ""; }; + 616591E211CA9BA200D6E256 /* FortsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FortsViewController.h; sourceTree = ""; }; + 616591E311CA9BA200D6E256 /* FortsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FortsViewController.m; sourceTree = ""; }; + 616591E411CA9BA200D6E256 /* GameConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameConfigViewController.h; sourceTree = ""; }; + 616591E511CA9BA200D6E256 /* GameConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameConfigViewController.m; sourceTree = ""; }; + 616591E611CA9BA200D6E256 /* GameSetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameSetup.h; sourceTree = ""; }; + 616591E711CA9BA200D6E256 /* GameSetup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameSetup.m; sourceTree = ""; }; + 616591E811CA9BA200D6E256 /* GeneralSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneralSettingsViewController.h; sourceTree = ""; }; + 616591E911CA9BA200D6E256 /* GeneralSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneralSettingsViewController.m; sourceTree = ""; }; + 616591EA11CA9BA200D6E256 /* GravesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GravesViewController.h; sourceTree = ""; }; + 616591EB11CA9BA200D6E256 /* GravesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GravesViewController.m; sourceTree = ""; }; + 616591EC11CA9BA200D6E256 /* HogHatViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HogHatViewController.h; sourceTree = ""; }; + 616591ED11CA9BA200D6E256 /* HogHatViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HogHatViewController.m; sourceTree = ""; }; + 616591EE11CA9BA200D6E256 /* LevelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LevelViewController.h; sourceTree = ""; }; + 616591EF11CA9BA200D6E256 /* LevelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LevelViewController.m; sourceTree = ""; }; + 616591F011CA9BA200D6E256 /* MainMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainMenuViewController.h; sourceTree = ""; }; + 616591F111CA9BA200D6E256 /* MainMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainMenuViewController.m; sourceTree = ""; }; + 616591F211CA9BA200D6E256 /* MapConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapConfigViewController.h; sourceTree = ""; }; + 616591F311CA9BA200D6E256 /* MapConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapConfigViewController.m; sourceTree = ""; }; + 616591F411CA9BA200D6E256 /* MasterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; + 616591F511CA9BA200D6E256 /* MasterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; + 616591F611CA9BA200D6E256 /* OverlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayViewController.h; sourceTree = ""; }; + 616591F711CA9BA200D6E256 /* OverlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverlayViewController.m; sourceTree = ""; }; + 616591F811CA9BA200D6E256 /* PopoverMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopoverMenuViewController.h; sourceTree = ""; }; + 616591F911CA9BA200D6E256 /* PopoverMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopoverMenuViewController.m; sourceTree = ""; }; + 616591FA11CA9BA200D6E256 /* SchemeSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemeSettingsViewController.h; sourceTree = ""; }; + 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SchemeSettingsViewController.m; sourceTree = ""; }; + 616591FC11CA9BA200D6E256 /* SchemeWeaponConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemeWeaponConfigViewController.h; sourceTree = ""; }; + 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SchemeWeaponConfigViewController.m; sourceTree = ""; }; + 616591FE11CA9BA200D6E256 /* SingleSchemeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleSchemeViewController.h; sourceTree = ""; }; + 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleSchemeViewController.m; sourceTree = ""; }; + 6165920011CA9BA200D6E256 /* SingleTeamViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleTeamViewController.h; sourceTree = ""; }; + 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleTeamViewController.m; sourceTree = ""; }; + 6165920211CA9BA200D6E256 /* SplitViewRootController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SplitViewRootController.h; sourceTree = ""; }; + 6165920311CA9BA200D6E256 /* SplitViewRootController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SplitViewRootController.m; sourceTree = ""; }; + 6165920411CA9BA200D6E256 /* TeamConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamConfigViewController.h; sourceTree = ""; }; + 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TeamConfigViewController.m; sourceTree = ""; }; + 6165920611CA9BA200D6E256 /* TeamSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamSettingsViewController.h; sourceTree = ""; }; + 6165920711CA9BA200D6E256 /* TeamSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TeamSettingsViewController.m; sourceTree = ""; }; + 6165920811CA9BA200D6E256 /* VoicesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoicesViewController.h; sourceTree = ""; }; + 6165920911CA9BA200D6E256 /* VoicesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VoicesViewController.m; sourceTree = ""; }; + 6165920A11CA9BA200D6E256 /* WeaponSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeaponSettingsViewController.h; sourceTree = ""; }; + 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeaponSettingsViewController.m; sourceTree = ""; }; + 6165922311CA9BD500D6E256 /* CGPointUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CGPointUtils.c; path = Classes/otherSrc/CGPointUtils.c; sourceTree = ""; }; + 6165922411CA9BD500D6E256 /* CGPointUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGPointUtils.h; path = Classes/otherSrc/CGPointUtils.h; sourceTree = ""; }; + 6165922511CA9BD500D6E256 /* CommodityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommodityFunctions.h; path = Classes/otherSrc/CommodityFunctions.h; sourceTree = ""; }; + 6165922611CA9BD500D6E256 /* CommodityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommodityFunctions.m; path = Classes/otherSrc/CommodityFunctions.m; sourceTree = ""; }; + 6165922711CA9BD500D6E256 /* HogButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HogButtonView.h; path = Classes/otherSrc/HogButtonView.h; sourceTree = ""; }; + 6165922811CA9BD500D6E256 /* HogButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HogButtonView.m; path = Classes/otherSrc/HogButtonView.m; sourceTree = ""; }; + 6165922911CA9BD500D6E256 /* PascalImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PascalImports.h; path = Classes/otherSrc/PascalImports.h; sourceTree = ""; }; + 6165922A11CA9BD500D6E256 /* SquareButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SquareButtonView.h; path = Classes/otherSrc/SquareButtonView.h; sourceTree = ""; }; + 6165922B11CA9BD500D6E256 /* SquareButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SquareButtonView.m; path = Classes/otherSrc/SquareButtonView.m; sourceTree = ""; }; + 6165922C11CA9BD500D6E256 /* UIImageExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIImageExtra.h; path = Classes/otherSrc/UIImageExtra.h; sourceTree = ""; }; + 6165922D11CA9BD500D6E256 /* UIImageExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIImageExtra.m; path = Classes/otherSrc/UIImageExtra.m; sourceTree = ""; }; + 6165923311CA9C4600D6E256 /* commands.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = commands.c; path = ../../misc/libopenalbridge/commands.c; sourceTree = SOURCE_ROOT; }; + 6165923411CA9C4600D6E256 /* commands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = commands.h; path = ../../misc/libopenalbridge/commands.h; sourceTree = SOURCE_ROOT; }; + 6165923511CA9C4600D6E256 /* globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = globals.h; path = ../../misc/libopenalbridge/globals.h; sourceTree = SOURCE_ROOT; }; + 6165923611CA9C4600D6E256 /* loaders.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loaders.c; path = ../../misc/libopenalbridge/loaders.c; sourceTree = SOURCE_ROOT; }; + 6165923711CA9C4600D6E256 /* loaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loaders.h; path = ../../misc/libopenalbridge/loaders.h; sourceTree = SOURCE_ROOT; }; + 6165923811CA9C4600D6E256 /* openalbridge_t.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = openalbridge_t.h; path = ../../misc/libopenalbridge/openalbridge_t.h; sourceTree = SOURCE_ROOT; }; + 6165923911CA9C4600D6E256 /* openalbridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = openalbridge.c; path = ../../misc/libopenalbridge/openalbridge.c; sourceTree = SOURCE_ROOT; }; + 6165923A11CA9C4600D6E256 /* openalbridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = openalbridge.h; path = ../../misc/libopenalbridge/openalbridge.h; sourceTree = SOURCE_ROOT; }; + 6165923B11CA9C4600D6E256 /* wrappers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wrappers.c; path = ../../misc/libopenalbridge/wrappers.c; sourceTree = SOURCE_ROOT; }; + 6165923C11CA9C4600D6E256 /* wrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wrappers.h; path = ../../misc/libopenalbridge/wrappers.h; sourceTree = SOURCE_ROOT; }; + 6165924911CA9CB400D6E256 /* GameConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "GameConfigViewController-iPad.xib"; path = "Resources/GameConfigViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "GameConfigViewController-iPhone.xib"; path = "Resources/GameConfigViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; + 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPad.xib"; path = "Resources/MainMenuViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; + 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPhone.xib"; path = "Resources/MainMenuViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; + 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPad.xib"; path = "Resources/MapConfigViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; + 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPhone.xib"; path = "Resources/MapConfigViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; + 6165924F11CA9CB400D6E256 /* OverlayViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "OverlayViewController-iPad.xib"; path = "Resources/OverlayViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; + 6165925011CA9CB400D6E256 /* OverlayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = OverlayViewController.xib; path = Resources/OverlayViewController.xib; sourceTree = SOURCE_ROOT; }; + 6165925911CA9CD300D6E256 /* arrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowDown.png; path = Resources/arrowDown.png; sourceTree = ""; }; + 6165925A11CA9CD300D6E256 /* arrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowLeft.png; path = Resources/arrowLeft.png; sourceTree = ""; }; + 6165925B11CA9CD300D6E256 /* arrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowRight.png; path = Resources/arrowRight.png; sourceTree = ""; }; + 6165925C11CA9CD300D6E256 /* arrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowUp.png; path = Resources/arrowUp.png; sourceTree = ""; }; + 6165925D11CA9CD300D6E256 /* joyPush.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyPush.png; path = Resources/joyPush.png; sourceTree = ""; }; + 6165926D11CA9D0E00D6E256 /* backgroundBottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundBottom.png; path = Resources/backgroundBottom.png; sourceTree = ""; }; + 6165926E11CA9D0E00D6E256 /* backgroundCenter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundCenter.png; path = Resources/backgroundCenter.png; sourceTree = ""; }; + 6165926F11CA9D0E00D6E256 /* backgroundLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundLeft.png; path = Resources/backgroundLeft.png; sourceTree = ""; }; + 6165927011CA9D0E00D6E256 /* backgroundRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundRight.png; path = Resources/backgroundRight.png; sourceTree = ""; }; + 6165927111CA9D0E00D6E256 /* backgroundTop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundTop.png; path = Resources/backgroundTop.png; sourceTree = ""; }; + 6165927211CA9D0E00D6E256 /* borderBottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = borderBottom.png; path = Resources/borderBottom.png; sourceTree = ""; }; + 6165927311CA9D0E00D6E256 /* borderTop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = borderTop.png; path = Resources/borderTop.png; sourceTree = ""; }; + 6165927B11CA9D3200D6E256 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/Default.png; sourceTree = ""; }; + 6165927C11CA9D3200D6E256 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = Resources/Icon.png; sourceTree = ""; }; + 6165927D11CA9D3200D6E256 /* menuCorner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menuCorner.png; path = Resources/menuCorner.png; sourceTree = ""; }; + 6165927E11CA9D3200D6E256 /* title.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = title.png; path = Resources/title.png; sourceTree = ""; }; + 6165928311CA9D4800D6E256 /* networkButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = networkButton.png; path = Resources/networkButton.png; sourceTree = ""; }; + 6165928411CA9D4800D6E256 /* playButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = playButton.png; path = Resources/playButton.png; sourceTree = ""; }; + 6165928511CA9D4800D6E256 /* settingsButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = settingsButton.png; path = Resources/settingsButton.png; sourceTree = ""; }; + 6165928611CA9D4800D6E256 /* storeButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = storeButton.png; path = Resources/storeButton.png; sourceTree = ""; }; + 6165929C11CA9E2F00D6E256 /* SDL_uikitappdelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_uikitappdelegate.h; path = Classes/otherSrc/SDL_uikitappdelegate.h; sourceTree = ""; }; + 6165929D11CA9E2F00D6E256 /* SDL_uikitappdelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_uikitappdelegate.m; path = Classes/otherSrc/SDL_uikitappdelegate.m; sourceTree = ""; }; 617987E1114AA34C00BA94A9 /* CCHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = CCHandlers.inc; path = ../../hedgewars/CCHandlers.inc; sourceTree = SOURCE_ROOT; }; 617987E4114AA34C00BA94A9 /* GSHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GSHandlers.inc; path = ../../hedgewars/GSHandlers.inc; sourceTree = SOURCE_ROOT; }; 617987E5114AA34C00BA94A9 /* HHHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = HHHandlers.inc; path = ../../hedgewars/HHHandlers.inc; sourceTree = SOURCE_ROOT; }; @@ -290,15 +371,6 @@ 6179880E114AA34C00BA94A9 /* uVisualGears.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uVisualGears.pas; path = ../../hedgewars/uVisualGears.pas; sourceTree = SOURCE_ROOT; }; 6179880F114AA34C00BA94A9 /* uWorld.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uWorld.pas; path = ../../hedgewars/uWorld.pas; sourceTree = SOURCE_ROOT; }; 61798852114AA44900BA94A9 /* config.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = config.inc; path = ../../hedgewars/config.inc; sourceTree = SOURCE_ROOT; }; - 61798856114AA48A00BA94A9 /* CGPointUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CGPointUtils.c; path = ../../cocoaTouch/otherSrc/CGPointUtils.c; sourceTree = SOURCE_ROOT; }; - 61798857114AA48A00BA94A9 /* CGPointUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGPointUtils.h; path = ../../cocoaTouch/otherSrc/CGPointUtils.h; sourceTree = SOURCE_ROOT; }; - 6179885A114AA48A00BA94A9 /* PascalImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PascalImports.h; path = ../../cocoaTouch/otherSrc/PascalImports.h; sourceTree = SOURCE_ROOT; }; - 61798863114AA4AA00BA94A9 /* SDL_uikitappdelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_uikitappdelegate.h; path = ../../cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h; sourceTree = SOURCE_ROOT; }; - 61798864114AA4AA00BA94A9 /* SDL_uikitappdelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_uikitappdelegate.m; path = ../../cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m; sourceTree = SOURCE_ROOT; }; - 6179886E114AA4D000BA94A9 /* MainMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MainMenuViewController.h; path = ../../cocoaTouch/MainMenuViewController.h; sourceTree = SOURCE_ROOT; }; - 6179886F114AA4D000BA94A9 /* MainMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MainMenuViewController.m; path = ../../cocoaTouch/MainMenuViewController.m; sourceTree = SOURCE_ROOT; }; - 61798887114AA4E600BA94A9 /* GameSetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GameSetup.h; path = ../../cocoaTouch/GameSetup.h; sourceTree = SOURCE_ROOT; }; - 61798888114AA4E600BA94A9 /* GameSetup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GameSetup.m; path = ../../cocoaTouch/GameSetup.m; sourceTree = SOURCE_ROOT; }; 617988D3114AAA3900BA94A9 /* SDLiPhoneOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDLiPhoneOS.xcodeproj; path = "../../../Library/SDL-1.3/SDL/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj"; sourceTree = SOURCE_ROOT; }; 61798916114AAF2100BA94A9 /* libfreetype_arm.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libfreetype_arm.a; sourceTree = ""; }; 61798917114AAF2100BA94A9 /* libfreetype_x86.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libfreetype_x86.a; sourceTree = ""; }; @@ -307,75 +379,11 @@ 6179898B114AB3FA00BA94A9 /* SDL_mixer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_mixer.xcodeproj; path = "../../../Library/SDL-1.3/SDL_mixer/Xcode-iPhoneOS/SDL_mixer.xcodeproj"; sourceTree = SOURCE_ROOT; }; 617989B3114AB47500BA94A9 /* SDL_net.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_net.xcodeproj; path = "../../../Library/SDL-1.3/SDL_net/Xcode-iPhoneOS/SDL_net.xcodeproj"; sourceTree = SOURCE_ROOT; }; 61798A0B114AB65600BA94A9 /* SDL_ttf.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_ttf.xcodeproj; path = "../../../Library/SDL-1.3/SDL_ttf/Xcode-iPhoneOS/SDL_ttf.xcodeproj"; sourceTree = SOURCE_ROOT; }; - 61798A1E114ADD2600BA94A9 /* backgroundBottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundBottom.png; path = ../../cocoaTouch/resources/backgroundBottom.png; sourceTree = SOURCE_ROOT; }; - 61798A1F114ADD2600BA94A9 /* backgroundCenter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundCenter.png; path = ../../cocoaTouch/resources/backgroundCenter.png; sourceTree = SOURCE_ROOT; }; - 61798A20114ADD2600BA94A9 /* backgroundLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundLeft.png; path = ../../cocoaTouch/resources/backgroundLeft.png; sourceTree = SOURCE_ROOT; }; - 61798A21114ADD2600BA94A9 /* backgroundRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundRight.png; path = ../../cocoaTouch/resources/backgroundRight.png; sourceTree = SOURCE_ROOT; }; - 61798A22114ADD2600BA94A9 /* backgroundTop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backgroundTop.png; path = ../../cocoaTouch/resources/backgroundTop.png; sourceTree = SOURCE_ROOT; }; - 61798A23114ADD2600BA94A9 /* borderBottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = borderBottom.png; path = ../../cocoaTouch/resources/borderBottom.png; sourceTree = SOURCE_ROOT; }; - 61798A24114ADD2600BA94A9 /* borderTop.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = borderTop.png; path = ../../cocoaTouch/resources/borderTop.png; sourceTree = SOURCE_ROOT; }; - 61798A25114ADD2600BA94A9 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = ../../cocoaTouch/resources/Default.png; sourceTree = SOURCE_ROOT; }; - 61798A26114ADD2600BA94A9 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = ../../cocoaTouch/resources/Icon.png; sourceTree = SOURCE_ROOT; }; - 61798A27114ADD2600BA94A9 /* networkButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = networkButton.png; path = ../../cocoaTouch/resources/networkButton.png; sourceTree = SOURCE_ROOT; }; - 61798A28114ADD2600BA94A9 /* playButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = playButton.png; path = ../../cocoaTouch/resources/playButton.png; sourceTree = SOURCE_ROOT; }; - 61798A29114ADD2600BA94A9 /* settingsButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = settingsButton.png; path = ../../cocoaTouch/resources/settingsButton.png; sourceTree = SOURCE_ROOT; }; - 61798A2A114ADD2600BA94A9 /* storeButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = storeButton.png; path = ../../cocoaTouch/resources/storeButton.png; sourceTree = SOURCE_ROOT; }; - 61798A2B114ADD2600BA94A9 /* title.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = title.png; path = ../../cocoaTouch/resources/title.png; sourceTree = SOURCE_ROOT; }; 61798A5E114AE08600BA94A9 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Data; sourceTree = ""; }; - 6179934E114BD5AB00BA94A9 /* menuCorner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = menuCorner.png; path = ../../cocoaTouch/resources/menuCorner.png; sourceTree = SOURCE_ROOT; }; - 6179936711501D3D00BA94A9 /* arrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowDown.png; path = ../../cocoaTouch/resources/arrowDown.png; sourceTree = SOURCE_ROOT; }; - 6179936811501D3D00BA94A9 /* arrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowLeft.png; path = ../../cocoaTouch/resources/arrowLeft.png; sourceTree = SOURCE_ROOT; }; - 6179936911501D3D00BA94A9 /* arrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowRight.png; path = ../../cocoaTouch/resources/arrowRight.png; sourceTree = SOURCE_ROOT; }; - 6179936A11501D3D00BA94A9 /* arrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowUp.png; path = ../../cocoaTouch/resources/arrowUp.png; sourceTree = SOURCE_ROOT; }; - 617995311150403800BA94A9 /* joyPush.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyPush.png; path = ../../cocoaTouch/resources/joyPush.png; sourceTree = SOURCE_ROOT; }; - 6184DEA111795DBD00AF6EFA /* UIImageExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIImageExtra.h; path = ../../cocoaTouch/otherSrc/UIImageExtra.h; sourceTree = SOURCE_ROOT; }; - 6184DEA211795DBD00AF6EFA /* UIImageExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIImageExtra.m; path = ../../cocoaTouch/otherSrc/UIImageExtra.m; sourceTree = SOURCE_ROOT; }; 618736B8118CA28600123B23 /* GearDrawing.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GearDrawing.inc; path = ../../hedgewars/GearDrawing.inc; sourceTree = SOURCE_ROOT; }; - 618BE5911175126900F22556 /* LevelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LevelViewController.h; path = ../../cocoaTouch/LevelViewController.h; sourceTree = SOURCE_ROOT; }; - 618BE5921175126900F22556 /* LevelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LevelViewController.m; path = ../../cocoaTouch/LevelViewController.m; sourceTree = SOURCE_ROOT; }; - 618BE60111751F4F00F22556 /* GravesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GravesViewController.h; path = ../../cocoaTouch/GravesViewController.h; sourceTree = SOURCE_ROOT; }; - 618BE60211751F4F00F22556 /* GravesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GravesViewController.m; path = ../../cocoaTouch/GravesViewController.m; sourceTree = SOURCE_ROOT; }; - 618BE6A1117527CD00F22556 /* VoicesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VoicesViewController.h; path = ../../cocoaTouch/VoicesViewController.h; sourceTree = SOURCE_ROOT; }; - 618BE6A2117527CD00F22556 /* VoicesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VoicesViewController.m; path = ../../cocoaTouch/VoicesViewController.m; sourceTree = SOURCE_ROOT; }; - 619C51BD116E40FC0049FD84 /* CommodityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommodityFunctions.h; path = ../../cocoaTouch/otherSrc/CommodityFunctions.h; sourceTree = SOURCE_ROOT; }; - 619C51BE116E40FC0049FD84 /* CommodityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommodityFunctions.m; path = ../../cocoaTouch/otherSrc/CommodityFunctions.m; sourceTree = SOURCE_ROOT; }; - 619C5230116E4E800049FD84 /* FlagsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlagsViewController.h; path = ../../cocoaTouch/FlagsViewController.h; sourceTree = SOURCE_ROOT; }; - 619C5231116E4E810049FD84 /* FlagsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlagsViewController.m; path = ../../cocoaTouch/FlagsViewController.m; sourceTree = SOURCE_ROOT; }; - 619C533C116E70050049FD84 /* FortsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FortsViewController.h; path = ../../cocoaTouch/FortsViewController.h; sourceTree = SOURCE_ROOT; }; - 619C533D116E70050049FD84 /* FortsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FortsViewController.m; path = ../../cocoaTouch/FortsViewController.m; sourceTree = SOURCE_ROOT; }; 61A117FE1168322700359010 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 61A118C911683C7600359010 /* MainMenuViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPad.xib"; path = "../../cocoaTouch/xib/MainMenuViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; - 61A118CB11683C7A00359010 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPhone.xib"; path = "../../cocoaTouch/xib/MainMenuViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; - 61A11A4C1168D13600359010 /* PopoverMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PopoverMenuViewController.h; path = ../../cocoaTouch/PopoverMenuViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11A4D1168D13600359010 /* PopoverMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PopoverMenuViewController.m; path = ../../cocoaTouch/PopoverMenuViewController.m; sourceTree = SOURCE_ROOT; }; - 61A11ABF1168D8B600359010 /* SplitViewRootController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SplitViewRootController.h; path = ../../cocoaTouch/SplitViewRootController.h; sourceTree = SOURCE_ROOT; }; - 61A11AC01168D8B600359010 /* SplitViewRootController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SplitViewRootController.m; path = ../../cocoaTouch/SplitViewRootController.m; sourceTree = SOURCE_ROOT; }; - 61A11AC71168DA9400359010 /* MasterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MasterViewController.h; path = ../../cocoaTouch/MasterViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11AC81168DA9400359010 /* MasterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MasterViewController.m; path = ../../cocoaTouch/MasterViewController.m; sourceTree = SOURCE_ROOT; }; - 61A11ACD1168DB1B00359010 /* TeamSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TeamSettingsViewController.h; path = ../../cocoaTouch/TeamSettingsViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11ACE1168DB1B00359010 /* TeamSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TeamSettingsViewController.m; path = ../../cocoaTouch/TeamSettingsViewController.m; sourceTree = SOURCE_ROOT; }; - 61A11AD41168DB3700359010 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailViewController.h; path = ../../cocoaTouch/DetailViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11AD51168DB3700359010 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailViewController.m; path = ../../cocoaTouch/DetailViewController.m; sourceTree = SOURCE_ROOT; }; - 61A11ADF1168DC6E00359010 /* SingleTeamViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SingleTeamViewController.h; path = ../../cocoaTouch/SingleTeamViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11AE01168DC6E00359010 /* SingleTeamViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SingleTeamViewController.m; path = ../../cocoaTouch/SingleTeamViewController.m; sourceTree = SOURCE_ROOT; }; - 61A11AE21168DC9400359010 /* HogHatViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HogHatViewController.h; path = ../../cocoaTouch/HogHatViewController.h; sourceTree = SOURCE_ROOT; }; - 61A11AE31168DC9400359010 /* HogHatViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HogHatViewController.m; path = ../../cocoaTouch/HogHatViewController.m; sourceTree = SOURCE_ROOT; }; - 61AA7AC9117FCC8200FDDD4D /* openalbridge_t.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = openalbridge_t.h; path = ../../misc/openalbridge/openalbridge_t.h; sourceTree = SOURCE_ROOT; }; - 61B22E0C1180FBF400B2FCE0 /* MapConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MapConfigViewController.h; path = ../../cocoaTouch/MapConfigViewController.h; sourceTree = SOURCE_ROOT; }; - 61B22E0D1180FBF400B2FCE0 /* MapConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MapConfigViewController.m; path = ../../cocoaTouch/MapConfigViewController.m; sourceTree = SOURCE_ROOT; }; 61C3251D1179A300001E70B1 /* libopenalbridge.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libopenalbridge.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 61C3253B1179A336001E70B1 /* globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = globals.h; path = ../../misc/openalbridge/globals.h; sourceTree = SOURCE_ROOT; }; - 61C3253C1179A336001E70B1 /* loaders.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loaders.c; path = ../../misc/openalbridge/loaders.c; sourceTree = SOURCE_ROOT; }; - 61C3253D1179A336001E70B1 /* loaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loaders.h; path = ../../misc/openalbridge/loaders.h; sourceTree = SOURCE_ROOT; }; - 61C3253E1179A336001E70B1 /* openalbridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = openalbridge.c; path = ../../misc/openalbridge/openalbridge.c; sourceTree = SOURCE_ROOT; }; - 61C325401179A336001E70B1 /* openalbridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = openalbridge.h; path = ../../misc/openalbridge/openalbridge.h; sourceTree = SOURCE_ROOT; }; - 61C325411179A336001E70B1 /* wrappers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = wrappers.c; path = ../../misc/openalbridge/wrappers.c; sourceTree = SOURCE_ROOT; }; - 61C325421179A336001E70B1 /* wrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wrappers.h; path = ../../misc/openalbridge/wrappers.h; sourceTree = SOURCE_ROOT; }; 61C3255A1179A384001E70B1 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; - 61CE250B115E749A0098C467 /* OverlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OverlayViewController.h; path = ../../cocoaTouch/OverlayViewController.h; sourceTree = SOURCE_ROOT; }; - 61CE250C115E749A0098C467 /* OverlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OverlayViewController.m; path = ../../cocoaTouch/OverlayViewController.m; sourceTree = SOURCE_ROOT; }; - 61CF496F117E702F00BF05B7 /* SquareButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SquareButtonView.h; path = ../../cocoaTouch/otherSrc/SquareButtonView.h; sourceTree = SOURCE_ROOT; }; - 61CF4970117E702F00BF05B7 /* SquareButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SquareButtonView.m; path = ../../cocoaTouch/otherSrc/SquareButtonView.m; sourceTree = SOURCE_ROOT; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 928301170F10CAFC00CC5A3C /* libfpc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libfpc.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -420,9 +428,52 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 61A118481168371400359010 /* Frontend */, - 61798887114AA4E600BA94A9 /* GameSetup.h */, - 61798888114AA4E600BA94A9 /* GameSetup.m */, + 616591DE11CA9BA200D6E256 /* DetailViewController.h */, + 616591DF11CA9BA200D6E256 /* DetailViewController.m */, + 616591E011CA9BA200D6E256 /* FlagsViewController.h */, + 616591E111CA9BA200D6E256 /* FlagsViewController.m */, + 616591E211CA9BA200D6E256 /* FortsViewController.h */, + 616591E311CA9BA200D6E256 /* FortsViewController.m */, + 616591E411CA9BA200D6E256 /* GameConfigViewController.h */, + 616591E511CA9BA200D6E256 /* GameConfigViewController.m */, + 616591E611CA9BA200D6E256 /* GameSetup.h */, + 616591E711CA9BA200D6E256 /* GameSetup.m */, + 616591E811CA9BA200D6E256 /* GeneralSettingsViewController.h */, + 616591E911CA9BA200D6E256 /* GeneralSettingsViewController.m */, + 616591EA11CA9BA200D6E256 /* GravesViewController.h */, + 616591EB11CA9BA200D6E256 /* GravesViewController.m */, + 616591EC11CA9BA200D6E256 /* HogHatViewController.h */, + 616591ED11CA9BA200D6E256 /* HogHatViewController.m */, + 616591EE11CA9BA200D6E256 /* LevelViewController.h */, + 616591EF11CA9BA200D6E256 /* LevelViewController.m */, + 616591F011CA9BA200D6E256 /* MainMenuViewController.h */, + 616591F111CA9BA200D6E256 /* MainMenuViewController.m */, + 616591F211CA9BA200D6E256 /* MapConfigViewController.h */, + 616591F311CA9BA200D6E256 /* MapConfigViewController.m */, + 616591F411CA9BA200D6E256 /* MasterViewController.h */, + 616591F511CA9BA200D6E256 /* MasterViewController.m */, + 616591F611CA9BA200D6E256 /* OverlayViewController.h */, + 616591F711CA9BA200D6E256 /* OverlayViewController.m */, + 616591F811CA9BA200D6E256 /* PopoverMenuViewController.h */, + 616591F911CA9BA200D6E256 /* PopoverMenuViewController.m */, + 616591FA11CA9BA200D6E256 /* SchemeSettingsViewController.h */, + 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */, + 616591FC11CA9BA200D6E256 /* SchemeWeaponConfigViewController.h */, + 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */, + 616591FE11CA9BA200D6E256 /* SingleSchemeViewController.h */, + 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */, + 6165920011CA9BA200D6E256 /* SingleTeamViewController.h */, + 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */, + 6165920211CA9BA200D6E256 /* SplitViewRootController.h */, + 6165920311CA9BA200D6E256 /* SplitViewRootController.m */, + 6165920411CA9BA200D6E256 /* TeamConfigViewController.h */, + 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */, + 6165920611CA9BA200D6E256 /* TeamSettingsViewController.h */, + 6165920711CA9BA200D6E256 /* TeamSettingsViewController.m */, + 6165920811CA9BA200D6E256 /* VoicesViewController.h */, + 6165920911CA9BA200D6E256 /* VoicesViewController.m */, + 6165920A11CA9BA200D6E256 /* WeaponSettingsViewController.h */, + 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */, ); path = Classes; sourceTree = ""; @@ -455,20 +506,20 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( - 61798863114AA4AA00BA94A9 /* SDL_uikitappdelegate.h */, - 61798864114AA4AA00BA94A9 /* SDL_uikitappdelegate.m */, - 61C325371179A325001E70B1 /* openalbridge */, - 612724D1117E28AF005B90CF /* HogButtonView.h */, - 612724D2117E28AF005B90CF /* HogButtonView.m */, - 61CF496F117E702F00BF05B7 /* SquareButtonView.h */, - 61CF4970117E702F00BF05B7 /* SquareButtonView.m */, - 6184DEA111795DBD00AF6EFA /* UIImageExtra.h */, - 6184DEA211795DBD00AF6EFA /* UIImageExtra.m */, - 61798857114AA48A00BA94A9 /* CGPointUtils.h */, - 61798856114AA48A00BA94A9 /* CGPointUtils.c */, - 619C51BD116E40FC0049FD84 /* CommodityFunctions.h */, - 619C51BE116E40FC0049FD84 /* CommodityFunctions.m */, - 6179885A114AA48A00BA94A9 /* PascalImports.h */, + 6165929C11CA9E2F00D6E256 /* SDL_uikitappdelegate.h */, + 6165929D11CA9E2F00D6E256 /* SDL_uikitappdelegate.m */, + 6165924811CA9C4B00D6E256 /* libopenalbridge */, + 6165922311CA9BD500D6E256 /* CGPointUtils.c */, + 6165922411CA9BD500D6E256 /* CGPointUtils.h */, + 6165922511CA9BD500D6E256 /* CommodityFunctions.h */, + 6165922611CA9BD500D6E256 /* CommodityFunctions.m */, + 6165922711CA9BD500D6E256 /* HogButtonView.h */, + 6165922811CA9BD500D6E256 /* HogButtonView.m */, + 6165922911CA9BD500D6E256 /* PascalImports.h */, + 6165922A11CA9BD500D6E256 /* SquareButtonView.h */, + 6165922B11CA9BD500D6E256 /* SquareButtonView.m */, + 6165922C11CA9BD500D6E256 /* UIImageExtra.h */, + 6165922D11CA9BD500D6E256 /* UIImageExtra.m */, 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */, ); name = "Other Sources"; @@ -483,10 +534,10 @@ 6179936F11501D4100BA94A9 /* back panels */, 6179936611501D1E00BA94A9 /* joystick */, 61798A5E114AE08600BA94A9 /* Data */, - 6179934E114BD5AB00BA94A9 /* menuCorner.png */, - 61798A25114ADD2600BA94A9 /* Default.png */, - 61798A26114ADD2600BA94A9 /* Icon.png */, - 61798A2B114ADD2600BA94A9 /* title.png */, + 6165927B11CA9D3200D6E256 /* Default.png */, + 6165927C11CA9D3200D6E256 /* Icon.png */, + 6165927D11CA9D3200D6E256 /* menuCorner.png */, + 6165927E11CA9D3200D6E256 /* title.png */, 8D1107310486CEB800E47090 /* Info.plist */, ); name = Resources; @@ -531,33 +582,19 @@ 6100DB1711544E8400F455E0 /* XIB */ = { isa = PBXGroup; children = ( - 617814E7118947A200C6A535 /* MapConfigViewController-iPad.xib */, - 615A92901183E31C006CA772 /* MapConfigViewController-iPhone.xib */, - 611E127C117BACC60044B62F /* GameConfigViewController-iPad.xib */, - 61A118C911683C7600359010 /* MainMenuViewController-iPad.xib */, - 611E127E117BACCD0044B62F /* GameConfigViewController-iPhone.xib */, - 615134B0116C2C5F001F16D1 /* OverlayViewController.xib */, - 61A118CB11683C7A00359010 /* MainMenuViewController-iPhone.xib */, + 6165924911CA9CB400D6E256 /* GameConfigViewController-iPad.xib */, + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */, + 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */, + 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */, + 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */, + 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */, + 6165924F11CA9CB400D6E256 /* OverlayViewController-iPad.xib */, + 6165925011CA9CB400D6E256 /* OverlayViewController.xib */, ); name = XIB; path = Classes; sourceTree = ""; }; - 611B0A94116B621600112153 /* first level */ = { - isa = PBXGroup; - children = ( - 611B0A9F116B626E00112153 /* GeneralSettingsViewController.h */, - 611B0AA0116B626E00112153 /* GeneralSettingsViewController.m */, - 61A11ACD1168DB1B00359010 /* TeamSettingsViewController.h */, - 61A11ACE1168DB1B00359010 /* TeamSettingsViewController.m */, - 611E1314117BBE5A0044B62F /* WeaponSettingsViewController.h */, - 611E1315117BBE5A0044B62F /* WeaponSettingsViewController.m */, - 611E1317117BBE700044B62F /* SchemeSettingsViewController.h */, - 611E1318117BBE700044B62F /* SchemeSettingsViewController.m */, - ); - name = "first level"; - sourceTree = ""; - }; 6127232F117DF752005B90CF /* Products */ = { isa = PBXGroup; children = ( @@ -566,17 +603,21 @@ name = Products; sourceTree = ""; }; - 61370672117B32A3004EE44A /* Game Config */ = { + 6165924811CA9C4B00D6E256 /* libopenalbridge */ = { isa = PBXGroup; children = ( - 61370673117B32EF004EE44A /* GameConfigViewController.h */, - 61370674117B32EF004EE44A /* GameConfigViewController.m */, - 61B22E0C1180FBF400B2FCE0 /* MapConfigViewController.h */, - 61B22E0D1180FBF400B2FCE0 /* MapConfigViewController.m */, - 61272422117E17CF005B90CF /* TeamConfigViewController.h */, - 61272423117E17CF005B90CF /* TeamConfigViewController.m */, + 6165923311CA9C4600D6E256 /* commands.c */, + 6165923411CA9C4600D6E256 /* commands.h */, + 6165923511CA9C4600D6E256 /* globals.h */, + 6165923611CA9C4600D6E256 /* loaders.c */, + 6165923711CA9C4600D6E256 /* loaders.h */, + 6165923811CA9C4600D6E256 /* openalbridge_t.h */, + 6165923911CA9C4600D6E256 /* openalbridge.c */, + 6165923A11CA9C4600D6E256 /* openalbridge.h */, + 6165923B11CA9C4600D6E256 /* wrappers.c */, + 6165923C11CA9C4600D6E256 /* wrappers.h */, ); - name = "Game Config"; + name = libopenalbridge; sourceTree = ""; }; 61798892114AA56300BA94A9 /* inc */ = { @@ -628,11 +669,11 @@ 6179936611501D1E00BA94A9 /* joystick */ = { isa = PBXGroup; children = ( - 617995311150403800BA94A9 /* joyPush.png */, - 6179936711501D3D00BA94A9 /* arrowDown.png */, - 6179936811501D3D00BA94A9 /* arrowLeft.png */, - 6179936911501D3D00BA94A9 /* arrowRight.png */, - 6179936A11501D3D00BA94A9 /* arrowUp.png */, + 6165925911CA9CD300D6E256 /* arrowDown.png */, + 6165925A11CA9CD300D6E256 /* arrowLeft.png */, + 6165925B11CA9CD300D6E256 /* arrowRight.png */, + 6165925C11CA9CD300D6E256 /* arrowUp.png */, + 6165925D11CA9CD300D6E256 /* joyPush.png */, ); name = joystick; sourceTree = ""; @@ -640,13 +681,13 @@ 6179936F11501D4100BA94A9 /* back panels */ = { isa = PBXGroup; children = ( - 61798A1E114ADD2600BA94A9 /* backgroundBottom.png */, - 61798A1F114ADD2600BA94A9 /* backgroundCenter.png */, - 61798A20114ADD2600BA94A9 /* backgroundLeft.png */, - 61798A21114ADD2600BA94A9 /* backgroundRight.png */, - 61798A22114ADD2600BA94A9 /* backgroundTop.png */, - 61798A23114ADD2600BA94A9 /* borderBottom.png */, - 61798A24114ADD2600BA94A9 /* borderTop.png */, + 6165926D11CA9D0E00D6E256 /* backgroundBottom.png */, + 6165926E11CA9D0E00D6E256 /* backgroundCenter.png */, + 6165926F11CA9D0E00D6E256 /* backgroundLeft.png */, + 6165927011CA9D0E00D6E256 /* backgroundRight.png */, + 6165927111CA9D0E00D6E256 /* backgroundTop.png */, + 6165927211CA9D0E00D6E256 /* borderBottom.png */, + 6165927311CA9D0E00D6E256 /* borderTop.png */, ); name = "back panels"; sourceTree = ""; @@ -654,90 +695,14 @@ 6179937011501D5800BA94A9 /* buttons */ = { isa = PBXGroup; children = ( - 61798A27114ADD2600BA94A9 /* networkButton.png */, - 61798A28114ADD2600BA94A9 /* playButton.png */, - 61798A29114ADD2600BA94A9 /* settingsButton.png */, - 61798A2A114ADD2600BA94A9 /* storeButton.png */, + 6165928311CA9D4800D6E256 /* networkButton.png */, + 6165928411CA9D4800D6E256 /* playButton.png */, + 6165928511CA9D4800D6E256 /* settingsButton.png */, + 6165928611CA9D4800D6E256 /* storeButton.png */, ); name = buttons; sourceTree = ""; }; - 618BE596117512A300F22556 /* third level */ = { - isa = PBXGroup; - children = ( - 61A11AE21168DC9400359010 /* HogHatViewController.h */, - 61A11AE31168DC9400359010 /* HogHatViewController.m */, - 618BE60111751F4F00F22556 /* GravesViewController.h */, - 618BE60211751F4F00F22556 /* GravesViewController.m */, - 618BE6A1117527CD00F22556 /* VoicesViewController.h */, - 618BE6A2117527CD00F22556 /* VoicesViewController.m */, - 619C533C116E70050049FD84 /* FortsViewController.h */, - 619C533D116E70050049FD84 /* FortsViewController.m */, - 619C5230116E4E800049FD84 /* FlagsViewController.h */, - 619C5231116E4E810049FD84 /* FlagsViewController.m */, - 618BE5911175126900F22556 /* LevelViewController.h */, - 618BE5921175126900F22556 /* LevelViewController.m */, - ); - name = "third level"; - sourceTree = ""; - }; - 61A118481168371400359010 /* Frontend */ = { - isa = PBXGroup; - children = ( - 61370672117B32A3004EE44A /* Game Config */, - 61A11AC31168DA2B00359010 /* Settings */, - 6179886E114AA4D000BA94A9 /* MainMenuViewController.h */, - 6179886F114AA4D000BA94A9 /* MainMenuViewController.m */, - 61CE250B115E749A0098C467 /* OverlayViewController.h */, - 61CE250C115E749A0098C467 /* OverlayViewController.m */, - 61A11A4C1168D13600359010 /* PopoverMenuViewController.h */, - 61A11A4D1168D13600359010 /* PopoverMenuViewController.m */, - ); - name = Frontend; - sourceTree = ""; - }; - 61A11AC31168DA2B00359010 /* Settings */ = { - isa = PBXGroup; - children = ( - 61A11ABF1168D8B600359010 /* SplitViewRootController.h */, - 61A11AC01168D8B600359010 /* SplitViewRootController.m */, - 61A11AC71168DA9400359010 /* MasterViewController.h */, - 61A11AC81168DA9400359010 /* MasterViewController.m */, - 61A11AD41168DB3700359010 /* DetailViewController.h */, - 61A11AD51168DB3700359010 /* DetailViewController.m */, - 611B0A94116B621600112153 /* first level */, - 61A11AD01168DB1F00359010 /* second level */, - 618BE596117512A300F22556 /* third level */, - ); - name = Settings; - sourceTree = ""; - }; - 61A11AD01168DB1F00359010 /* second level */ = { - isa = PBXGroup; - children = ( - 61A11ADF1168DC6E00359010 /* SingleTeamViewController.h */, - 61A11AE01168DC6E00359010 /* SingleTeamViewController.m */, - 615FBA5311A93C9800B139F9 /* SingleSchemeViewController.h */, - 615FBA5411A93C9800B139F9 /* SingleSchemeViewController.m */, - ); - name = "second level"; - sourceTree = ""; - }; - 61C325371179A325001E70B1 /* openalbridge */ = { - isa = PBXGroup; - children = ( - 61AA7AC9117FCC8200FDDD4D /* openalbridge_t.h */, - 61C3253B1179A336001E70B1 /* globals.h */, - 61C3253C1179A336001E70B1 /* loaders.c */, - 61C3253D1179A336001E70B1 /* loaders.h */, - 61C3253E1179A336001E70B1 /* openalbridge.c */, - 61C325401179A336001E70B1 /* openalbridge.h */, - 61C325411179A336001E70B1 /* wrappers.c */, - 61C325421179A336001E70B1 /* wrappers.h */, - ); - name = openalbridge; - sourceTree = ""; - }; 9283015C0F10E48900CC5A3C /* Pascal Sources */ = { isa = PBXGroup; children = ( @@ -787,12 +752,12 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 61C325451179A336001E70B1 /* globals.h in Headers */, - 61C325471179A336001E70B1 /* loaders.h in Headers */, - 61C325491179A336001E70B1 /* openalbridge.h in Headers */, - 61C3254B1179A336001E70B1 /* wrappers.h in Headers */, - 61AA7ACA117FCC8200FDDD4D /* openalbridge_t.h in Headers */, - 615FBA5511A93C9800B139F9 /* SingleSchemeViewController.h in Headers */, + 6165923E11CA9C4600D6E256 /* commands.h in Headers */, + 6165923F11CA9C4600D6E256 /* globals.h in Headers */, + 6165924111CA9C4600D6E256 /* loaders.h in Headers */, + 6165924211CA9C4600D6E256 /* openalbridge_t.h in Headers */, + 6165924411CA9C4600D6E256 /* openalbridge.h in Headers */, + 6165924611CA9C4600D6E256 /* wrappers.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -944,38 +909,39 @@ 61A118D311683CD100359010 /* HedgewarsTitle.png in Resources */, 61A118D411683CD100359010 /* Multiplayer.png in Resources */, 61A118D511683CD100359010 /* NetworkPlay.png in Resources */, - 61798A2C114ADD2600BA94A9 /* backgroundBottom.png in Resources */, - 61798A2D114ADD2600BA94A9 /* backgroundCenter.png in Resources */, - 61798A2E114ADD2600BA94A9 /* backgroundLeft.png in Resources */, - 61798A2F114ADD2600BA94A9 /* backgroundRight.png in Resources */, - 61798A30114ADD2600BA94A9 /* backgroundTop.png in Resources */, - 61798A31114ADD2600BA94A9 /* borderBottom.png in Resources */, - 61798A32114ADD2600BA94A9 /* borderTop.png in Resources */, - 61798A33114ADD2600BA94A9 /* Default.png in Resources */, - 61798A34114ADD2600BA94A9 /* Icon.png in Resources */, - 61798A35114ADD2600BA94A9 /* networkButton.png in Resources */, - 61798A36114ADD2600BA94A9 /* playButton.png in Resources */, - 61798A37114ADD2600BA94A9 /* settingsButton.png in Resources */, - 61798A38114ADD2600BA94A9 /* storeButton.png in Resources */, - 61798A39114ADD2600BA94A9 /* title.png in Resources */, 61799289114AE08700BA94A9 /* Data in Resources */, - 6179934F114BD5AB00BA94A9 /* menuCorner.png in Resources */, - 6179936B11501D3D00BA94A9 /* arrowDown.png in Resources */, - 6179936C11501D3D00BA94A9 /* arrowLeft.png in Resources */, - 6179936D11501D3D00BA94A9 /* arrowRight.png in Resources */, - 6179936E11501D3D00BA94A9 /* arrowUp.png in Resources */, - 617995321150403800BA94A9 /* joyPush.png in Resources */, - 61A118CA11683C7600359010 /* MainMenuViewController-iPad.xib in Resources */, - 61A118CC11683C7A00359010 /* MainMenuViewController-iPhone.xib in Resources */, 6122CD01116BECCA002648E9 /* Default-Landscape.png in Resources */, 6151347E116C2803001F16D1 /* Icon-iPad.png in Resources */, - 615134B1116C2C5F001F16D1 /* OverlayViewController.xib in Resources */, 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */, - 611E127D117BACC60044B62F /* GameConfigViewController-iPad.xib in Resources */, - 611E127F117BACCD0044B62F /* GameConfigViewController-iPhone.xib in Resources */, 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */, - 615A92911183E31C006CA772 /* MapConfigViewController-iPhone.xib in Resources */, - 617814E8118947A200C6A535 /* MapConfigViewController-iPad.xib in Resources */, + 6165925111CA9CB400D6E256 /* GameConfigViewController-iPad.xib in Resources */, + 6165925211CA9CB400D6E256 /* GameConfigViewController-iPhone.xib in Resources */, + 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */, + 6165925411CA9CB400D6E256 /* MainMenuViewController-iPhone.xib in Resources */, + 6165925511CA9CB400D6E256 /* MapConfigViewController-iPad.xib in Resources */, + 6165925611CA9CB400D6E256 /* MapConfigViewController-iPhone.xib in Resources */, + 6165925711CA9CB400D6E256 /* OverlayViewController-iPad.xib in Resources */, + 6165925811CA9CB400D6E256 /* OverlayViewController.xib in Resources */, + 6165925E11CA9CD300D6E256 /* arrowDown.png in Resources */, + 6165925F11CA9CD300D6E256 /* arrowLeft.png in Resources */, + 6165926011CA9CD300D6E256 /* arrowRight.png in Resources */, + 6165926111CA9CD300D6E256 /* arrowUp.png in Resources */, + 6165926211CA9CD300D6E256 /* joyPush.png in Resources */, + 6165927411CA9D0E00D6E256 /* backgroundBottom.png in Resources */, + 6165927511CA9D0E00D6E256 /* backgroundCenter.png in Resources */, + 6165927611CA9D0E00D6E256 /* backgroundLeft.png in Resources */, + 6165927711CA9D0E00D6E256 /* backgroundRight.png in Resources */, + 6165927811CA9D0E00D6E256 /* backgroundTop.png in Resources */, + 6165927911CA9D0E00D6E256 /* borderBottom.png in Resources */, + 6165927A11CA9D0E00D6E256 /* borderTop.png in Resources */, + 6165927F11CA9D3200D6E256 /* Default.png in Resources */, + 6165928011CA9D3200D6E256 /* Icon.png in Resources */, + 6165928111CA9D3200D6E256 /* menuCorner.png in Resources */, + 6165928211CA9D3200D6E256 /* title.png in Resources */, + 6165928711CA9D4800D6E256 /* networkButton.png in Resources */, + 6165928811CA9D4800D6E256 /* playButton.png in Resources */, + 6165928911CA9D4800D6E256 /* settingsButton.png in Resources */, + 6165928A11CA9D4800D6E256 /* storeButton.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -993,7 +959,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\nsvn export --force ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/.svn*\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Pirate,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/"; + shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/.svn*\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,KnockBall,Ruler,BasketBall}\n\n#the following ones must be removed when their support is implemented\n\n#delete some voices\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/{Classic,British,Mobster,Pirate,Robot,Russian,Singer,Surfer}\n\n#delete all names\nrm -rf ${PROJECT_DIR}/Data/Names/\n\n#delete all missions\nrm -rf ${PROJECT_DIR}/Data/Missions/\n\n#delete all reserved hats\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/"; showEnvVarsInLog = 0; }; 9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = { @@ -1067,35 +1033,36 @@ 6179883A114AA34C00BA94A9 /* uTeams.pas in Sources */, 6179883C114AA34C00BA94A9 /* uVisualGears.pas in Sources */, 6179883D114AA34C00BA94A9 /* uWorld.pas in Sources */, - 6179885C114AA48A00BA94A9 /* CGPointUtils.c in Sources */, - 61798869114AA4AA00BA94A9 /* SDL_uikitappdelegate.m in Sources */, - 6179887D114AA4D000BA94A9 /* MainMenuViewController.m in Sources */, - 61798889114AA4E600BA94A9 /* GameSetup.m in Sources */, - 61CE250D115E749A0098C467 /* OverlayViewController.m in Sources */, - 61A11A4E1168D13600359010 /* PopoverMenuViewController.m in Sources */, - 61A11AC91168DA9400359010 /* MasterViewController.m in Sources */, - 61A11ACF1168DB1B00359010 /* TeamSettingsViewController.m in Sources */, - 61A11AD61168DB3700359010 /* DetailViewController.m in Sources */, - 61A11AE11168DC6E00359010 /* SingleTeamViewController.m in Sources */, - 61A11AE41168DC9400359010 /* HogHatViewController.m in Sources */, - 611B0AA1116B626E00112153 /* GeneralSettingsViewController.m in Sources */, - 619C51BF116E40FC0049FD84 /* CommodityFunctions.m in Sources */, - 619C5232116E4E810049FD84 /* FlagsViewController.m in Sources */, - 619C533E116E70050049FD84 /* FortsViewController.m in Sources */, - 618BE5931175126900F22556 /* LevelViewController.m in Sources */, - 618BE60311751F4F00F22556 /* GravesViewController.m in Sources */, - 618BE6A3117527CD00F22556 /* VoicesViewController.m in Sources */, - 6184DEA311795DBD00AF6EFA /* UIImageExtra.m in Sources */, - 61370676117B32EF004EE44A /* GameConfigViewController.m in Sources */, - 611E1316117BBE5A0044B62F /* WeaponSettingsViewController.m in Sources */, - 611E1319117BBE700044B62F /* SchemeSettingsViewController.m in Sources */, - 61272424117E17CF005B90CF /* TeamConfigViewController.m in Sources */, - 612724D3117E28AF005B90CF /* HogButtonView.m in Sources */, - 61CF4971117E702F00BF05B7 /* SquareButtonView.m in Sources */, - 61B22E0F1180FBF400B2FCE0 /* MapConfigViewController.m in Sources */, - 61AE62C711A067FE008DC32E /* SplitViewRootController.m in Sources */, - 615FBA5811A93D6700B139F9 /* SingleSchemeViewController.m in Sources */, 611F4D4B11B27A9900F9759A /* uScript.pas in Sources */, + 6165920C11CA9BA200D6E256 /* DetailViewController.m in Sources */, + 6165920D11CA9BA200D6E256 /* FlagsViewController.m in Sources */, + 6165920E11CA9BA200D6E256 /* FortsViewController.m in Sources */, + 6165920F11CA9BA200D6E256 /* GameConfigViewController.m in Sources */, + 6165921011CA9BA200D6E256 /* GameSetup.m in Sources */, + 6165921111CA9BA200D6E256 /* GeneralSettingsViewController.m in Sources */, + 6165921211CA9BA200D6E256 /* GravesViewController.m in Sources */, + 6165921311CA9BA200D6E256 /* HogHatViewController.m in Sources */, + 6165921411CA9BA200D6E256 /* LevelViewController.m in Sources */, + 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */, + 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */, + 6165921711CA9BA200D6E256 /* MasterViewController.m in Sources */, + 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */, + 6165921911CA9BA200D6E256 /* PopoverMenuViewController.m in Sources */, + 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */, + 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */, + 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */, + 6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */, + 6165921E11CA9BA200D6E256 /* SplitViewRootController.m in Sources */, + 6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */, + 6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */, + 6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */, + 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */, + 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */, + 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */, + 6165923011CA9BD500D6E256 /* HogButtonView.m in Sources */, + 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */, + 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */, + 6165929E11CA9E2F00D6E256 /* SDL_uikitappdelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1103,9 +1070,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 61C325461179A336001E70B1 /* loaders.c in Sources */, - 61C325481179A336001E70B1 /* openalbridge.c in Sources */, - 61C3254A1179A336001E70B1 /* wrappers.c in Sources */, + 6165923D11CA9C4600D6E256 /* commands.c in Sources */, + 6165924011CA9C4600D6E256 /* loaders.c in Sources */, + 6165924311CA9C4600D6E256 /* openalbridge.c in Sources */, + 6165924511CA9C4600D6E256 /* wrappers.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1483,7 +1451,7 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + 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"; diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/Default-Landscape.png Binary file project_files/HedgewarsMobile/Resources/Default-Landscape.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/Default.png Binary file project_files/HedgewarsMobile/Resources/Default.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/GameConfigViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/GameConfigViewController-iPad.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,489 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 266 + {{0, 724}, {1024, 44}} + + NO + NO + IBIPadFramework + + YES + + Back + IBIPadFramework + 1 + + + + IBIPadFramework + + 5 + + + 1 + Start Game + IBIPadFramework + 90 + 2 + + + + + + {1024, 768} + + 3 + MQA + + NO + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 17 + + + + buttonPressed: + + + + 23 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + 15 + + + YES + + + + + + + + 16 + + + + + 18 + + + + + 22 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 15.IBPluginDependency + 16.IBPluginDependency + 18.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 22.IBPluginDependency + + + YES + GameConfigViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{285, -28}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 29 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + IBProjectSource + ../../cocoaTouch/GameConfigViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj + 3 + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/GameConfigViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/GameConfigViewController-iPhone.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,640 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 266 + + YES + + + 292 + {{97, 8}, {245, 30}} + + NO + IBCocoaTouchFramework + 2 + 3 + 0 + + YES + Map + Teams + Details + + + YES + + + + + + YES + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + {{0, 276}, {480, 44}} + + NO + NO + IBCocoaTouchFramework + + YES + + Back + IBCocoaTouchFramework + 1 + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + + + + + IBCocoaTouchFramework + + 5 + + + 1 + Start Game + IBCocoaTouchFramework + 90 + 2 + + + + + + {480, 320} + + + 3 + MQA + + NO + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 17 + + + + buttonPressed: + + + + 23 + + + + segmentPressed: + + + 13 + + 29 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + 15 + + + YES + + + + + + + + + + 16 + + + + + 18 + + + + + 19 + + + + + 21 + + + YES + + + + + + 20 + + + + + 22 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 15.IBPluginDependency + 16.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 20.IBPluginDependency + 22.IBPluginDependency + + + YES + GameConfigViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{639, 516}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 29 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + YES + + YES + availableTeamsTableView + mapButton + randomButton + schemesButton + startButton + weaponsButton + + + YES + UITableView + UIButton + UIButton + UIButton + UIBarButtonItem + UIButton + + + + IBProjectSource + ../../cocoaTouch/GameConfigViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj + 3 + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/Icon-iPad.png Binary file project_files/HedgewarsMobile/Resources/Icon-iPad.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/Icon.png Binary file project_files/HedgewarsMobile/Resources/Icon.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,689 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 274 + {1024, 768} + + NO + IBIPadFramework + + NSImage + Background.png + + + + + 292 + {{147, 20}, {745, 146}} + + NO + 4 + NO + IBIPadFramework + + NSImage + HedgewarsTitle.png + + + + + 292 + {{147, 200}, {258, 215}} + + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + NSImage + Multiplayer.png + + + + + 292 + {{634, 493}, {258, 215}} + + NO + 1 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + NetworkPlay.png + + + + + 292 + {{175, 600}, {18, 19}} + + NO + 3 + IBIPadFramework + 0 + 0 + + 3 + YES + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + 292 + {{762, 183}, {87, 21}} + + NO + YES + 7 + NO + IBIPadFramework + + + Helvetica-Oblique + 17 + 16 + + + 1 + MSAxIDEAA + + 1 + + + + 1 + 10 + + + + 292 + {{267, 579}, {72, 62}} + + NO + 2 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + settingsButton.png + + + + {1024, 768} + + 1 + MCAwIDAAA + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + switchViews: + + + 7 + + 47 + + + + switchViews: + + + 7 + + 48 + + + + switchViews: + + + 7 + + 49 + + + + versionLabel + + + + 51 + + + + switchViews: + + + 7 + + 54 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 38 + + + + + 39 + + + local + + + 40 + + + multi + + + 45 + + + + + 50 + + + + + 52 + + + + + 37 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 40.IBPluginDependency + 45.IBPluginDependency + 50.IBPluginDependency + 52.IBPluginDependency + + + YES + MainMenuViewController + UIResponder + {{224, 119}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 86 + + + + YES + + MainMenuViewController + UIViewController + + switchViews: + id + + + YES + + YES + settingsSplitViewController + versionLabel + + + YES + UISplitViewController + UILabel + + + + IBProjectSource + ../../cocoaTouch/MainMenuViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISplitViewController + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj + 3 + + YES + + YES + Background.png + HedgewarsTitle.png + Multiplayer.png + NetworkPlay.png + settingsButton.png + + + YES + {1024, 768} + {720, 140} + {264, 219} + {314, 260} + {57, 51} + + + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,785 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 293 + + YES + + + 274 + {{0, 21}, {480, 278}} + + + 3 + MCAwAA + + 4 + NO + IBCocoaTouchFramework + + NSImage + backgroundCenter.png + + + + + 293 + {{121, 25}, {240, 52}} + + NO + NO + 4 + NO + IBCocoaTouchFramework + + NSImage + title.png + + + + + 289 + {{240, 102}, {220, 52}} + + + 1 + MCAwIDAgMAA + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + playButton.png + + + + + 265 + {{240, 177}, {220, 52}} + + + 1 + MCAwIDAgMAA + + NO + NO + 3 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + networkButton.png + + + + + 260 + {{12, 144}, {220, 52}} + + + 1 + MCAwIDAgMAA + + NO + NO + 3 + IBCocoaTouchFramework + 0 + 0 + + + + 3 + MAA + + + + NSImage + storeButton.png + + + + + 292 + {{60, 102}, {145, 21}} + + NO + YES + NO + IBCocoaTouchFramework + + + Helvetica-Oblique + 17 + 16 + + + 1 + MSAxIDEAA + + + 1 + 10 + 1 + + + + 269 + {{209, 237}, {59, 52}} + + NO + NO + 2 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + settingsButton.png + + + + + 290 + {480, 17} + + NO + NO + 4 + NO + IBCocoaTouchFramework + + NSImage + borderTop.png + + + + + 266 + {{0, 297}, {480, 23}} + + NO + NO + 4 + NO + IBCocoaTouchFramework + + NSImage + borderBottom.png + + + + + 292 + {{20, 270}, {18, 19}} + + NO + 3 + IBCocoaTouchFramework + 0 + 0 + + 3 + YES + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + {480, 320} + + + 1 + MCAwIDAAA + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + switchViews: + + + 7 + + 30 + + + + versionLabel + + + + 37 + + + + switchViews: + + + 7 + + 38 + + + + switchViews: + + + 7 + + 39 + + + + switchViews: + + + 7 + + 40 + + + + switchViews: + + + 7 + + 42 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 35 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 36 + + + + + 41 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 22.IBPluginDependency + 23.IBPluginDependency + 24.IBPluginDependency + 25.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 28.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 41.IBPluginDependency + + + YES + MainMenuViewController + UIResponder + {{432, 461}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 42 + + + + YES + + MainMenuViewController + UIViewController + + switchViews: + id + + + versionLabel + UILabel + + + IBProjectSource + ../../cocoaTouch/MainMenuViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj + 3 + + YES + + YES + backgroundCenter.png + borderBottom.png + borderTop.png + networkButton.png + playButton.png + settingsButton.png + storeButton.png + title.png + + + YES + {480, 278} + {480, 21} + {480, 21} + {217, 51} + {216, 51} + {57, 51} + {216, 51} + {262, 84} + + + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,787 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + + YES + + + 289 + {{756, 170}, {240, 30}} + + NO + IBIPadFramework + 2 + 3 + 0 + + YES + Random + Map + Maze + + + YES + + + + + + YES + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + + 292 + {{570, 117}, {149, 23}} + + NO + IBIPadFramework + 0 + 0 + 0.05000000074505806 + 0.05000000074505806 + + + + 289 + {{746, 20}, {256, 128}} + + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + 4 + 4 + 4 + 4 + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + + + 292 + {{623, 20}, {42, 21}} + + NO + YES + 7 + NO + IBIPadFramework + ... + + 1 + MCAwIDAAA + + + 1 + 10 + 1 + + + + 292 + {{572, 66}, {145, 29}} + + NO + YES + 7 + NO + IBIPadFramework + Label + + Helvetica + 24 + 16 + + + + 1 + 10 + 1 + + + + 265 + {{724, 224}, {300, 500}} + + + 3 + MSAwAA + + YES + IBIPadFramework + NO + 1 + 0 + YES + 44 + 22 + 22 + + + + -2147483356 + {{0, 224}, {300, 500}} + + NO + IBIPadFramework + 0 + 0 + + 1 + teams section + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + {1024, 724} + + + 2 + MC44MzkyMTU3NTU1IDAuODQ3MDU4ODkyMyAwLjg3MDU4ODMwMjYAA + + + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + updatePreview + + + 7 + + 12 + + + + previewButton + + + + 13 + + + + maxLabel + + + + 16 + + + + sizeLabel + + + + 18 + + + + sliderChanged: + + + 13 + + 19 + + + + sliderEndedChanging: + + + 7 + + 20 + + + + segmentedControl + + + + 21 + + + + segmentedControlChanged: + + + 13 + + 22 + + + + slider + + + + 23 + + + + dataSource + + + + 26 + + + + delegate + + + + 27 + + + + tableView + + + + 32 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 7 + + + + + 8 + + + + + 11 + + + + + 17 + + + + + 25 + + + Table View (Themes) + + + 39 + + + + + 9 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 11.IBPluginDependency + 17.IBPluginDependency + 25.IBPluginDependency + 39.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + MapConfigViewController + UIResponder + {{255, 115}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 49 + + + + YES + + MapConfigViewController + UIViewController + + YES + + YES + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + updatePreview + + + YES + id + id + id + id + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + UIButton + UISegmentedControl + UILabel + UISlider + UITableView + + + + IBProjectSource + ../../cocoaTouch/MapConfigViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj + 3 + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,750 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 292 + {{28, 166}, {240, 30}} + + NO + IBCocoaTouchFramework + 2 + 3 + 0 + + YES + Random + Map + Maze + + + YES + + + + + + YES + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + + 292 + {{121, 209}, {149, 23}} + + NO + IBCocoaTouchFramework + 0 + 0 + 0.05000000074505806 + 0.05000000074505806 + + + + 292 + {{20, 20}, {256, 128}} + + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + + + 292 + {{54, 234}, {42, 21}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + ... + + 1 + MCAwIDAAA + + + 1 + 10 + 1 + + + + 292 + {{123, 239}, {145, 29}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Label + + Helvetica + 24 + 16 + + + + 1 + 10 + 1 + + + + 274 + {{295, 0}, {185, 276}} + + + YES + IBCocoaTouchFramework + NO + 1 + 0 + YES + 44 + 22 + 22 + + + {480, 276} + + + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + updatePreview + + + 7 + + 12 + + + + previewButton + + + + 13 + + + + maxLabel + + + + 16 + + + + sizeLabel + + + + 18 + + + + sliderChanged: + + + 13 + + 19 + + + + sliderEndedChanging: + + + 7 + + 20 + + + + segmentedControl + + + + 21 + + + + segmentedControlChanged: + + + 13 + + 22 + + + + slider + + + + 23 + + + + dataSource + + + + 26 + + + + delegate + + + + 27 + + + + tableView + + + + 32 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 11 + + + + + 17 + + + + + 25 + + + Table View (Themes) + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 11.IBPluginDependency + 17.IBPluginDependency + 25.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + MapConfigViewController + UIResponder + {{744, 568}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 32 + + + + YES + + MapConfigViewController + UIViewController + + YES + + YES + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + updatePreview + + + YES + id + id + id + id + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + UIButton + UISegmentedControl + UILabel + UISlider + UITableView + + + + IBProjectSource + ../../cocoaTouch/MapConfigViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj + 3 + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/OverlayViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/OverlayViewController-iPad.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,945 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 292 + {{0, 675}, {39, 53}} + + NO + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + arrowLeft.png + + + + + 292 + {{90, 675}, {39, 54}} + + NO + NO + 1 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowRight.png + + + + + 292 + {{964, 690}, {64, 48}} + + NO + NO + 6 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + joyPush.png + + + + + 292 + {{919, 665}, {64, 50}} + + NO + NO + 5 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 292 + {{908, 723}, {61, 45}} + + NO + NO + 4 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 292 + {{37, 638}, {53, 39}} + + NO + NO + 2 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowUp.png + + + + + 292 + {{37, 729}, {53, 39}} + + NO + NO + 3 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowDown.png + + + + + 292 + {{956, -5}, {72, 64}} + + NO + 10 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + menuCorner.png + + + + {1024, 768} + + + 3 + MSAwAA + + NO + YES + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + 1 + + 8 + + + + buttonReleased: + + + 9 + + 9 + + + + buttonReleased: + + + 7 + + 10 + + + + buttonReleased: + + + 8 + + 11 + + + + buttonReleased: + + + 8 + + 13 + + + + buttonReleased: + + + 9 + + 14 + + + + buttonPressed: + + + 1 + + 15 + + + + buttonReleased: + + + 7 + + 16 + + + + buttonReleased: + + + 9 + + 18 + + + + buttonPressed: + + + 1 + + 19 + + + + buttonReleased: + + + 8 + + 20 + + + + buttonReleased: + + + 7 + + 21 + + + + buttonReleased: + + + 8 + + 23 + + + + buttonReleased: + + + 9 + + 24 + + + + buttonPressed: + + + 1 + + 25 + + + + buttonReleased: + + + 7 + + 26 + + + + buttonReleased: + + + 9 + + 44 + + + + buttonPressed: + + + 1 + + 45 + + + + buttonReleased: + + + 8 + + 46 + + + + buttonReleased: + + + 7 + + 47 + + + + buttonReleased: + + + 8 + + 49 + + + + buttonReleased: + + + 7 + + 50 + + + + buttonReleased: + + + 9 + + 51 + + + + buttonPressed: + + + 1 + + 52 + + + + buttonReleased: + + + 9 + + 54 + + + + buttonReleased: + + + 7 + + 55 + + + + buttonPressed: + + + 1 + + 56 + + + + buttonReleased: + + + 8 + + 57 + + + + buttonPressed: + + + 7 + + 60 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + left + + + 12 + + + right + + + 17 + + + up + + + 22 + + + down + + + 43 + + + push2 + + + 48 + + + push1 + + + 53 + + + push3 + + + 58 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 12.IBPluginDependency + 17.IBPluginDependency + 22.IBPluginDependency + 4.IBPluginDependency + 43.IBPluginDependency + 48.IBPluginDependency + 53.IBPluginDependency + 58.IBPluginDependency + + + YES + OverlayViewController + UIResponder + {{0, 273}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 60 + + + + YES + + OverlayViewController + UIViewController + + YES + + YES + buttonPressed: + buttonReleased: + + + YES + id + id + + + + popoverController + id + + + IBProjectSource + ../../cocoaTouch/OverlayViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/HedgewarsMobile.xcodeproj + 3 + + YES + + YES + arrowDown.png + arrowLeft.png + arrowRight.png + arrowUp.png + joyPush.png + menuCorner.png + + + YES + {64, 64} + {64, 64} + {64, 64} + {64, 64} + {64, 64} + {64, 64} + + + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/OverlayViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/OverlayViewController.xib Thu Jun 17 20:30:39 2010 +0200 @@ -0,0 +1,947 @@ + + + + 800 + 10D573 + 762 + 1038.29 + 460.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 87 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 268 + {{0, 237}, {39, 53}} + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + arrowLeft.png + + + + + 268 + {{75, 237}, {39, 54}} + + NO + NO + 1 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowRight.png + + + + + 265 + {{416, 227}, {64, 64}} + + NO + NO + 5 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + joyPush.png + + + + + 265 + {{368, 207}, {64, 64}} + + NO + NO + 6 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 265 + {{344, 256}, {64, 64}} + + NO + NO + 4 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 268 + {{29, 207}, {53, 39}} + + NO + NO + 2 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowUp.png + + + + + 268 + {{29, 281}, {53, 39}} + + NO + NO + 3 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowDown.png + + + + + 289 + {{412, -6}, {72, 64}} + + NO + 10 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + menuCorner.png + + + + {480, 320} + + + 3 + MSAwAA + + NO + YES + NO + YES + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + 1 + + 8 + + + + buttonReleased: + + + 9 + + 9 + + + + buttonReleased: + + + 7 + + 10 + + + + buttonReleased: + + + 8 + + 11 + + + + buttonReleased: + + + 8 + + 13 + + + + buttonReleased: + + + 9 + + 14 + + + + buttonPressed: + + + 1 + + 15 + + + + buttonReleased: + + + 7 + + 16 + + + + buttonReleased: + + + 9 + + 18 + + + + buttonPressed: + + + 1 + + 19 + + + + buttonReleased: + + + 8 + + 20 + + + + buttonReleased: + + + 7 + + 21 + + + + buttonReleased: + + + 8 + + 23 + + + + buttonReleased: + + + 9 + + 24 + + + + buttonPressed: + + + 1 + + 25 + + + + buttonReleased: + + + 7 + + 26 + + + + buttonReleased: + + + 9 + + 44 + + + + buttonPressed: + + + 1 + + 45 + + + + buttonReleased: + + + 8 + + 46 + + + + buttonReleased: + + + 7 + + 47 + + + + buttonReleased: + + + 8 + + 49 + + + + buttonReleased: + + + 7 + + 50 + + + + buttonReleased: + + + 9 + + 51 + + + + buttonPressed: + + + 1 + + 52 + + + + buttonReleased: + + + 9 + + 54 + + + + buttonReleased: + + + 7 + + 55 + + + + buttonPressed: + + + 1 + + 56 + + + + buttonReleased: + + + 8 + + 57 + + + + buttonPressed: + + + 7 + + 60 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + left + + + 12 + + + right + + + 17 + + + up + + + 22 + + + down + + + 43 + + + push2 + + + 48 + + + push1 + + + 53 + + + push3 + + + 58 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 12.IBPluginDependency + 17.IBPluginDependency + 22.IBPluginDependency + 4.IBPluginDependency + 43.IBPluginDependency + 48.IBPluginDependency + 53.IBPluginDependency + 58.IBPluginDependency + + + YES + OverlayViewController + UIResponder + {{222, 756}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 62 + + + + YES + + OverlayViewController + UIViewController + + YES + + YES + buttonPressed: + buttonReleased: + + + YES + id + id + + + + popoverController + id + + + IBProjectSource + ../../cocoaTouch/OverlayViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../project_files/HedgewarsMobile/Hedgewars.xcodeproj + 3 + + YES + + YES + arrowDown.png + arrowLeft.png + arrowRight.png + arrowUp.png + joyPush.png + menuCorner.png + + + YES + {64, 64} + {64, 64} + {64, 64} + {64, 64} + {64, 64} + {64, 64} + + + 87 + + diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/arrowDown.png Binary file project_files/HedgewarsMobile/Resources/arrowDown.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/arrowLeft.png Binary file project_files/HedgewarsMobile/Resources/arrowLeft.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/arrowRight.png Binary file project_files/HedgewarsMobile/Resources/arrowRight.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/arrowUp.png Binary file project_files/HedgewarsMobile/Resources/arrowUp.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/backgroundBottom.png Binary file project_files/HedgewarsMobile/Resources/backgroundBottom.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/backgroundCenter.png Binary file project_files/HedgewarsMobile/Resources/backgroundCenter.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/backgroundLeft.png Binary file project_files/HedgewarsMobile/Resources/backgroundLeft.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/backgroundRight.png Binary file project_files/HedgewarsMobile/Resources/backgroundRight.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/backgroundTop.png Binary file project_files/HedgewarsMobile/Resources/backgroundTop.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/borderBottom.png Binary file project_files/HedgewarsMobile/Resources/borderBottom.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/borderTop.png Binary file project_files/HedgewarsMobile/Resources/borderTop.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/joyPush.png Binary file project_files/HedgewarsMobile/Resources/joyPush.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/menuCorner.png Binary file project_files/HedgewarsMobile/Resources/menuCorner.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/networkButton.png Binary file project_files/HedgewarsMobile/Resources/networkButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/playButton.png Binary file project_files/HedgewarsMobile/Resources/playButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/settingsButton.png Binary file project_files/HedgewarsMobile/Resources/settingsButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/storeButton.png Binary file project_files/HedgewarsMobile/Resources/storeButton.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/Resources/title.png Binary file project_files/HedgewarsMobile/Resources/title.png has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/libfreetype_arm.a Binary file project_files/HedgewarsMobile/libfreetype_arm.a has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/libfreetype_x86.a Binary file project_files/HedgewarsMobile/libfreetype_x86.a has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/libpng_arm.a Binary file project_files/HedgewarsMobile/libpng_arm.a has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/libpng_x86.a Binary file project_files/HedgewarsMobile/libpng_x86.a has changed diff -r f589230fa21b -r 59dbd31e9953 project_files/HedgewarsMobile/libvorbis_arm.a Binary file project_files/HedgewarsMobile/libvorbis_arm.a has changed