rip out the sync weapons/schemes switch and place it into settings; also perform some runtime check on what can be enabled
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Sun Jul 24 19:14:56 2011 +0200
@@ -46,6 +46,7 @@
#define MAPS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"]
#define MISSIONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"]
#define LOCALE_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"]
+#define SCRIPTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/Multiplayer/"]
#define MSG_MEMCLEAN() DLog(@"has cleaned up some memory");
#define MSG_DIDUNLOAD() DLog(@"unloaded");
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Sun Jul 24 19:14:56 2011 +0200
@@ -28,8 +28,11 @@
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"];
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"sound"];
[settings setObject:[NSNumber numberWithBool:NO] forKey:@"classic_menu"];
- [settings setObject:[NSNumber numberWithBool:YES] forKey:@"enhanced"];
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"multitasking"];
+ [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sync_ws"];
+
+ // limit graphic usage on older devices
+ [settings setObject:[NSNumber numberWithBool:IS_VERY_POWERFUL(getModelType())] forKey:@"enhanced"];
// don't overwrite these two strings when present
if ([settings objectForKey:@"username"] == nil)
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Sun Jul 24 19:14:56 2011 +0200
@@ -84,6 +84,9 @@
case 30: //alternateSwitch
[settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"];
break;
+ case 90: //synched weapons/scheme
+ [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"sync_ws"];
+ break;
case 70: //enhanced graphics
[settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"enhanced"];
break;
@@ -117,16 +120,13 @@
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section {
switch (section) {
case 0: // user and pass
- return 1; // set 2 here for the password field
+ return 1; // set 2 here to show the password field
break;
case 1: // audio
return 2;
break;
- case 2: // other stuff
- if (IS_IPAD() == YES)
- return 4;
- else
- return 3;
+ case 2: // other options
+ return 5;
break;
default:
DLog(@"Nope");
@@ -225,6 +225,7 @@
}
switchContent = (UISwitch *)cell.accessoryView;
+ cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
switch (row) {
case 0:
cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"");
@@ -233,22 +234,34 @@
switchContent.tag = 30;
break;
case 1:
- cell.textLabel.text = NSLocalizedString(@"Enanched Graphics Mode", @"");
- cell.detailTextLabel.text = NSLocalizedString(@"The game will use more memory so it could crash!", @"");
- switchContent.on = [[settings objectForKey:@"enhanced"] boolValue];
- switchContent.tag = 70;
+ cell.textLabel.text = NSLocalizedString(@"Sync Schemes and Weapons", @"");
+ cell.detailTextLabel.text = NSLocalizedString(@"Choosing a Scheme will select its associated Weapon", @"");
+ switchContent.on = [[settings objectForKey:@"sync_ws"] boolValue];
+ switchContent.tag = 90;
break;
case 2:
- cell.textLabel.text = NSLocalizedString(@"Multitasking Enabled", @"");
+ cell.textLabel.text = NSLocalizedString(@"Multitasking", @"");
cell.detailTextLabel.text = NSLocalizedString(@"Disable it in case of issues when returing in game", @"");
switchContent.on = [[settings objectForKey:@"multitasking"] boolValue];
switchContent.tag = 80;
break;
case 3:
+ cell.textLabel.text = NSLocalizedString(@"Enanched Graphics", @"");
+ cell.detailTextLabel.text = NSLocalizedString(@"Beware that the game will consume more memory", @"");
+ switchContent.on = [[settings objectForKey:@"enhanced"] boolValue];
+ switchContent.tag = 70;
+ // prevent the oldest devices to even think about enabling it
+ if (IS_NOT_POWERFUL(getModelType()))
+ switchContent.enabled = NO;
+ break;
+ case 4:
cell.textLabel.text = NSLocalizedString(@"Classic Ammo Menu", @"");
cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@"");
switchContent.on = [[settings objectForKey:@"classic_menu"] boolValue];
switchContent.tag = 60;
+ // remove this when classic ammomenu works on iphone as well
+ if (IS_IPAD() == NO)
+ switchContent.enabled = NO;
break;
default:
DLog(@"Nope");
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Sun Jul 24 19:14:56 2011 +0200
@@ -32,7 +32,6 @@
NSString *selectedScheme;
NSString *selectedWeapon;
- UISwitch *syncSwitch;
BOOL hideSections;
}
@@ -42,7 +41,6 @@
@property (nonatomic,retain) NSIndexPath *lastIndexPath_we;
@property (nonatomic,retain) NSString *selectedScheme;
@property (nonatomic,retain) NSString *selectedWeapon;
-@property (nonatomic,retain) UISwitch *syncSwitch;
-(void) fillSections;
-(void) emptySections;
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Jul 24 19:14:56 2011 +0200
@@ -25,7 +25,7 @@
#define LABEL_TAG 57423
@implementation SchemeWeaponConfigViewController
-@synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon, syncSwitch;
+@synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon;
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
@@ -85,16 +85,14 @@
if (hideSections)
return 0;
else
- return 3;
+ return 2;
}
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return [self.listOfSchemes count];
- else if (section == 1)
+ else
return [self.listOfWeapons count];
- else
- return 1;
}
// Customize the appearance of table view cells.
@@ -120,7 +118,7 @@
[checkbox release];
self.lastIndexPath_sc = indexPath;
}
- } else if (1 == section) {
+ } else {
cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
@@ -132,17 +130,6 @@
[checkbox release];
self.lastIndexPath_we = indexPath;
}
- } else {
- if (self.syncSwitch == nil) {
- UISwitch *theSwitch = [[UISwitch alloc] init];
- [theSwitch setOn:YES];
- self.syncSwitch = theSwitch;
- [theSwitch release];
- }
- cell.textLabel.text = IS_IPAD() ? NSLocalizedString(@"Sync Schemes",@"") : NSLocalizedString(@"Sync Schemes and Weapons",@"");
- cell.detailTextLabel.text = IS_IPAD() ? nil : NSLocalizedString(@"Choosing a Scheme will select its associated Weapon",@"");
- cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
- cell.accessoryView = self.syncSwitch;
}
cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK;
@@ -160,10 +147,8 @@
NSString *text;
if (section == 0)
text = NSLocalizedString(@"Schemes",@"");
- else if (section == 1)
+ else
text = NSLocalizedString(@"Weapons",@"");
- else
- text = NSLocalizedString(@"Options",@"");
UILabel *theLabel = createBlueLabel(text, frame);
theLabel.center = CGPointMake(self.view.frame.size.width/2, 20);
@@ -198,7 +183,9 @@
if ([indexPath section] == 0) {
self.lastIndexPath_sc = indexPath;
self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow];
- if (self.syncSwitch.on) {
+
+ NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
+ if ([[settings objectForKey:@"sync_ws"] boolValue]) {
for (NSString *str in self.listOfWeapons) {
if ([str isEqualToString:self.selectedScheme]) {
int index = [self.listOfSchemes indexOfObject:str];
@@ -224,7 +211,7 @@
hideSections = NO;
NSRange range;
range.location = 0;
- range.length = 3;
+ range.length = 2;
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
[self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
self.selectedScheme = @"Default.plist";
@@ -240,7 +227,7 @@
hideSections = YES;
NSRange range;
range.location = 0;
- range.length = 3;
+ range.length = 2;
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range];
[self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
self.selectedScheme = @"Default.plist";
@@ -266,7 +253,6 @@
self.lastIndexPath_we = nil;
self.listOfSchemes = nil;
self.listOfWeapons = nil;
- self.syncSwitch = nil;
MSG_MEMCLEAN();
}
[super didReceiveMemoryWarning];
@@ -279,7 +265,6 @@
self.lastIndexPath_we = nil;
self.selectedScheme = nil;
self.selectedWeapon = nil;
- self.syncSwitch = nil;
MSG_DIDUNLOAD();
[super viewDidUnload];
}
@@ -292,7 +277,6 @@
releaseAndNil(lastIndexPath_we);
releaseAndNil(selectedScheme);
releaseAndNil(selectedWeapon);
- releaseAndNil(syncSwitch);
[super dealloc];
}
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Jul 24 16:58:40 2011 -0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Jul 24 19:14:56 2011 +0200
@@ -1370,7 +1370,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 3`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 3`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 3`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 3 | cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/../../hedgewars/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics 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 ${PROJECT_DIR}/../../QTfrontend/res/StatsMedal*.png ${PROJECT_DIR}/Data/Graphics/Btn/\ncp ${PROJECT_DIR}/../../QTfrontend/res/StatsR.png ${PROJECT_DIR}/Data/Graphics/Btn/StatsStar.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/\n\necho \"Removing text and dummy files...\"\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 *.svgz -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\n\n#delete useless fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball,TrophyRace,CTF_Blizzard,Control} ${PROJECT_DIR}/Data/Missions/Maps/\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\n#remove WIP themes (check they are not used in Maps)\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\necho \"Done\"";
+ shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 3`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 3`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 3`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 3 | cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/../../hedgewars/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics 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 ${PROJECT_DIR}/../../QTfrontend/res/StatsMedal*.png ${PROJECT_DIR}/Data/Graphics/Btn/\ncp ${PROJECT_DIR}/../../QTfrontend/res/StatsR.png ${PROJECT_DIR}/Data/Graphics/Btn/StatsStar.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels/\n\necho \"Removing text and dummy files...\"\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 *.svgz -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete unused fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball,TrophyRace,CTF_Blizzard,Control} ${PROJECT_DIR}/Data/Missions/Maps/\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\"";
showEnvVarsInLog = 0;
};
9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {