settings are applied to game launch
authorkoda
Fri, 15 Jan 2010 10:03:31 +0000
changeset 2696 41aa7b56c17b
parent 2695 ed789a7ef68d
child 2697 75880595a9f1
settings are applied to game launch
cocoaTouch/GameSetup.h
cocoaTouch/GameSetup.m
cocoaTouch/MainMenuViewController.xib
cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h
cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m
cocoaTouch/SDLOverrides/SDL_uikitview.m
cocoaTouch/SettingsViewController.h
cocoaTouch/SettingsViewController.m
cocoaTouch/SettingsViewController.xib
cocoaTouch/otherSrc/PascalImports.h
--- a/cocoaTouch/GameSetup.h	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/GameSetup.h	Fri Jan 15 10:03:31 2010 +0000
@@ -7,12 +7,16 @@
 //
 
 #import <Foundation/Foundation.h>
-
+#import "SDL_net.h"
 
 @interface GameSetup : NSObject {
 	NSString *localeString;
 	NSDictionary *systemSettings;
+	
 	BOOL engineProtocolStarted;
+	NSInteger ipcPort;
+	TCPsocket sd, csd; // Socket descriptor, Client socket descriptor
+
 }
 
 
@@ -22,6 +26,8 @@
 -(void) setArgsForLocalPlay;
 -(void) engineProtocol;
 -(void) startThread: (NSString *)selector;
-
+-(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName;
+-(int) sendToEngine: (NSString *)string;
+-(void) unloadSettings;
 @end
 
--- a/cocoaTouch/GameSetup.m	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/GameSetup.m	Fri Jan 15 10:03:31 2010 +0000
@@ -11,22 +11,8 @@
 #import "SDL_net.h"
 #import "PascalImports.h"
 
-
 #define BUFFER_SIZE 256
 
-
-// they should go in the interface
-TCPsocket sd, csd; /* Socket descriptor, Client socket descriptor */
-NSInteger ipcPort;
-
-int sendToEngine (NSString * string) {
-	Uint8 length = [string length];
-	
-	SDLNet_TCP_Send(csd, &length , 1);
-	return SDLNet_TCP_Send(csd, [string UTF8String], length);
-}
-
-
 @implementation GameSetup
 
 @synthesize localeString, systemSettings;
@@ -40,6 +26,14 @@
 	return self;
 }
 
+-(void) dealloc {
+	[self.systemSettings release];
+	[self.localeString autorelease];
+	[super dealloc];
+}
+
+#pragma mark -
+#pragma mark Thread/Network relevant code
 -(void) startThread: (NSString *) selector {
 	SEL usage = NSSelectorFromString(selector);
 	
@@ -50,6 +44,13 @@
 	}
 }
 
+-(int) sendToEngine: (NSString *)string {
+	Uint8 length = [string length];
+	
+	SDLNet_TCP_Send(csd, &length , 1);
+	return SDLNet_TCP_Send(csd, [string UTF8String], length);
+}
+
 -(void) engineProtocol {
 	IPaddress ip;
 	int idx, eProto;
@@ -100,77 +101,77 @@
 				// send config data data
 				
 				// local game
-				sendToEngine(@"TL");
+				[self sendToEngine:@"TL"];
 				
 				// seed info
-				sendToEngine(@"eseed {232c1b42-7d39-4ee6-adf8-4240e1f1efb8}");
+				[self sendToEngine:@"eseed {232c1b42-7d39-4ee6-adf8-4240e1f1efb8}"];
 				
 				// various flags
-				sendToEngine(@"e$gmflags 256"); 
+				[self sendToEngine:@"e$gmflags 256"]; 
 
 				// various flags
-				sendToEngine(@"e$damagepct 100");
+				[self sendToEngine:@"e$damagepct 100"];
 				
 				// various flags
-				sendToEngine(@"e$turntime 45000");
+				[self sendToEngine:@"e$turntime 45000"];
 				
 				// various flags
-				sendToEngine(@"e$minestime 3000");
+				[self sendToEngine:@"e$minestime 3000"];
 				
 				// various flags
-				sendToEngine(@"e$landadds 4");
+				[self sendToEngine:@"e$landadds 4"];
 				
 				// various flags
-				sendToEngine(@"e$sd_turns 15");
+				[self sendToEngine:@"e$sd_turns 15"];
 												
 				// various flags
-				sendToEngine(@"e$casefreq 5");
+				[self sendToEngine:@"e$casefreq 5"];
 				
 				// various flags
-				sendToEngine(@"e$template_filter 1");
+				[self sendToEngine:@"e$template_filter 1"];
 								
 				// theme info
-				sendToEngine(@"etheme Freeway");
+				[self sendToEngine:@"etheme Freeway"];
 				
 				// team 1 info
-				sendToEngine(@"eaddteam 4421353 System Cats");
+				[self sendToEngine:@"eaddteam 4421353 System Cats"];
 				
 				// team 1 grave info
-				sendToEngine(@"egrave star");
+				[self sendToEngine:@"egrave star"];
 				
 				// team 1 fort info
-				sendToEngine(@"efort  Earth");
+				[self sendToEngine:@"efort  Earth"];
 								
 				// team 1 voicepack info
-				sendToEngine(@"evoicepack Classic");
+				[self sendToEngine:@"evoicepack Classic"];
 				
-				// team 1 binds (skipped)				
+				// team 1 binds (skipped)			
 				// team 1 members info
-				sendToEngine(@"eaddhh 0 100 Snow Leopard");
-				sendToEngine(@"ehat NoHat");
+				[self sendToEngine:@"eaddhh 0 100 Snow Leopard"];
+				[self sendToEngine:@"ehat NoHat"];
 				
 				// team 1 ammostore
-				sendToEngine(@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144");
+				[self sendToEngine:@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144"];
 
 				// team 2 info
-				sendToEngine(@"eaddteam 4100897 Poke-MAN");
+				[self sendToEngine:@"eaddteam 4100897 Poke-MAN"];
 				
 				// team 2 grave info
-				sendToEngine(@"egrave Badger");
+				[self sendToEngine:@"egrave Badger"];
 				
 				// team 2 fort info
-				sendToEngine(@"efort UFO");
+				[self sendToEngine:@"efort UFO"];
 				
 				// team 2 voicepack info
-				sendToEngine(@"evoicepack Classic");
+				[self sendToEngine:@"evoicepack Classic"];
 				
 				// team 2 binds (skipped)
 				// team 2 members info
-				sendToEngine(@"eaddhh 0 100 Raichu");
-				sendToEngine(@"ehat Bunny");
+				[self sendToEngine:@"eaddhh 0 100 Raichu"];
+				[self sendToEngine:@"ehat Bunny"];
 				
 				// team 2 ammostore
-				sendToEngine(@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144");
+				[self sendToEngine:@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144"];
 				
 				clientQuit = NO;
 			} else {
@@ -196,7 +197,7 @@
 				switch (buffer[0]) {
 					case '?':
 						NSLog(@"Ping? Pong!");
-						sendToEngine(@"!");
+						[self sendToEngine:@"!"];
 						break;
 					case 'E':
 						NSLog(@"ERROR - last console line: [%s]", buffer);
@@ -240,13 +241,36 @@
 	[NSThread exit];
 }
 
+#pragma mark -
+#pragma mark Settings setup methods
+-(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName {
+	NSString *filePath = [SDLUIKitDelegate dataFilePath:fileName];
+	
+	if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {	
+		NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath];
+		[self setValue:dict forKey:objName];
+		[dict release];
+	} else {
+		//TODO create it
+		[NSException raise:@"File NOT found" format:@"The file %@ was not found at %@", fileName, filePath];
+	}
+
+}
+
+-(void) unloadSettings {
+	for (id obj in self)
+		if ([obj isKindOfClass:[NSDictionary class]]) {
+			[obj release];
+		}
+}
+
 -(void) setArgsForLocalPlay {
-	NSString *portNumber = [[NSString alloc] initWithFormat:@"%d",ipcPort];
+	NSString *portNumber = [[NSString alloc] initWithFormat:@"%d", ipcPort];
+	//NSString *username = [[NSString alloc] initWithString:[systemSettings objectForKey:@"username"]];
 	/*for (NSString *theString in [NSLocale ISOLanguageCodes]) {
 		NSLog(theString);
 	}*/
 	
-	
 	memset(forward_argv, 0, forward_argc);
 	
 	forward_argc = 18;
@@ -258,16 +282,16 @@
 	forward_argv[ 4] = "16";							// cBitsStr
 	forward_argv[ 5] = [portNumber UTF8String];			// ipcPort;
 	forward_argv[ 6] = "1";								// cFullScreen (NO EFFECT)
-	forward_argv[ 7] = "0";				// isSoundEnabled (TOSET)
+	forward_argv[ 7] = [[systemSettings objectForKey:@"effects"] UTF8String];	// isSoundEnabled
 	forward_argv[ 8] = "1";								// cVSyncInUse (UNUSED)
 	forward_argv[ 9] = [localeString UTF8String];		// cLocaleFName
-	forward_argv[10] = "100";			// cInitVolume (TOSET)
+	forward_argv[10] = [[systemSettings objectForKey:@"volume"] UTF8String];	// cInitVolume
 	forward_argv[11] = "8";								// cTimerInterval
 	forward_argv[12] = "Data";							// PathPrefix
-	forward_argv[13] = "1";				// cShowFPS (TOSET?)
-	forward_argv[14] = "0";				// cAltDamage (TOSET)
-	forward_argv[15] = "Koda";			// UserNick (DecodeBase64(ParamStr(15)) FTW) <- TODO
-	forward_argv[16] = "0";				// isMusicEnabled (TOSET)
+	forward_argv[13] = "1";								// cShowFPS (TOSET?)
+	forward_argv[14] = [[systemSettings objectForKey:@"alternate"] UTF8String];	// cAltDamage (TOSET)
+	forward_argv[15] = "Koda";				// UserNick (DecodeBase64(ParamStr(15)) FTW) <- TODO
+	forward_argv[16] = [[systemSettings objectForKey:@"music"] UTF8String];		// isMusicEnabled
 	forward_argv[17] = "0";								// cReducedQuality
 
 	[portNumber release];
@@ -276,11 +300,6 @@
 
 
 
--(void) dealloc {
-	[self.systemSettings release];
-	[self.localeString autorelease];
-	[super dealloc];
-}
 
 
 
--- a/cocoaTouch/MainMenuViewController.xib	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/MainMenuViewController.xib	Fri Jan 15 10:03:31 2010 +0000
@@ -12,7 +12,6 @@
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="1"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -45,6 +44,7 @@
 						<int key="NSvFlags">274</int>
 						<string key="NSFrameSize">{320, 431}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
 						<object class="NSColor" key="IBUIBackgroundColor">
 							<int key="NSColorSpace">3</int>
 							<bytes key="NSWhite">MCAwAA</bytes>
@@ -62,6 +62,7 @@
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{44, 131}, {232, 61}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
 						<object class="NSColor" key="IBUIBackgroundColor">
 							<int key="NSColorSpace">1</int>
 							<bytes key="NSRGB">MCAwIDAgMAA</bytes>
@@ -97,6 +98,7 @@
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{20, 215}, {232, 61}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
 						<object class="NSColor" key="IBUIBackgroundColor">
 							<int key="NSColorSpace">1</int>
 							<bytes key="NSRGB">MCAwIDAgMAA</bytes>
@@ -122,6 +124,7 @@
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{44, 298}, {232, 61}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
 						<object class="NSColor" key="IBUIBackgroundColor">
 							<int key="NSColorSpace">1</int>
 							<bytes key="NSRGB">MCAwIDAgMAA</bytes>
@@ -147,6 +150,7 @@
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{44, 384}, {232, 21}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
+						<reference key="NSWindow"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -168,6 +172,7 @@
 				</object>
 				<string key="NSFrameSize">{320, 431}</string>
 				<reference key="NSSuperview"/>
+				<reference key="NSWindow"/>
 				<reference key="IBUIBackgroundColor" ref="918890028"/>
 				<object class="IBUISimulatedTabBarMetrics" key="IBUISimulatedBottomBarMetrics"/>
 			</object>
@@ -217,14 +222,6 @@
 					<int key="connectionID">12</int>
 				</object>
 				<object class="IBConnectionRecord">
-					<object class="IBCocoaTouchOutletConnection" key="connection">
-						<string key="label">versionLabel</string>
-						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="168836711"/>
-					</object>
-					<int key="connectionID">14</int>
-				</object>
-				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">notYetImplemented</string>
 						<reference key="source" ref="1049354127"/>
@@ -242,6 +239,14 @@
 					</object>
 					<int key="connectionID">16</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">versionLabel</string>
+						<reference key="source" ref="372490531"/>
+						<reference key="destination" ref="168836711"/>
+					</object>
+					<int key="connectionID">17</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -346,7 +351,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">16</int>
+			<int key="maxID">17</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.h	Fri Jan 15 10:03:31 2010 +0000
@@ -41,6 +41,7 @@
 +(SDLUIKitDelegate *)sharedAppDelegate;
 -(void) startSDLgame;
 +(void) resetFrontend;
++(NSString *)dataFilePath:(NSString *)fileName;
 
 int forward_argc;
 char **forward_argv;
--- a/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitappdelegate.m	Fri Jan 15 10:03:31 2010 +0000
@@ -28,13 +28,16 @@
 #import "SDL_video.h"
 #import "GameSetup.h"
 
+//#import "SoundEffect.h"	
+//	SoundEffect *erasingSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Erase" ofType:@"caf"]];
+//	SoundEffect *selectSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Select" ofType:@"caf"]];
+
+
 #ifdef main
 #undef main
 #endif
 
 extern int SDL_main(int argc, char *argv[]);
-BOOL isServerRunning = NO;
-
 int main (int argc, char **argv) {
 	int i;
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -63,6 +66,13 @@
 	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
 }
 
+-(void) dealloc {
+	[setup release];
+	[controller release];
+	[window release];
+	[super dealloc];
+}
+
 -(void) launchSDL_main{
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	
@@ -78,34 +88,29 @@
 -(IBAction) startSDLgame {
 	
 	[setup startThread:@"engineProtocol"];
-	
+	[setup loadSettingsFromFile:@"settings.plist" forKey:@"systemSettings"];
+
 	// remove the current view to free resources
 	[UIView beginAnimations:nil context:NULL];
 	[UIView setAnimationDuration:1.5];
 	controller.view.alpha = 0;
 	[UIView commitAnimations];
 	[controller.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1.5];
-	//[controller.view removeFromSuperview];
-	
+
 	NSLog(@"Game is launching...");
 
 	[NSThread detachNewThreadSelector:@selector(launchSDL_main) toTarget:self withObject:nil];
 	
-	//SDL_main(forward_argc, forward_argv);
-
-
 }
 
 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
 -(void) applicationDidFinishLaunching:(UIApplication *)application {
 	[application setStatusBarHidden:YES animated:NO];
 
-	setup = [[GameSetup alloc] init]; 
+	setup = [[GameSetup alloc] init];
 	/* Set working directory to resource path */
 	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
-//#import "SoundEffect.h"	
-//	SoundEffect *erasingSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Erase" ofType:@"caf"]];
-//	SoundEffect *selectSound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"Select" ofType:@"caf"]];
+
 	[window addSubview:controller.view];
 	[window makeKeyAndVisible];
 }
@@ -150,10 +155,12 @@
 	[SDLUIKitDelegate sharedAppDelegate].controller.view.alpha = 1;
 	[UIView commitAnimations];
 	
+	[[SDLUIKitDelegate sharedAppDelegate].setup unloadSettings];
 	[[SDLUIKitDelegate sharedAppDelegate].window makeKeyAndVisible];
 }
 
-
+#pragma mark -
+#pragma mark Convenience methods
 void IPH_returnFrontend (void) {
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
@@ -165,11 +172,10 @@
 }
 
 
--(void) dealloc {
-	[setup release];
-	[controller release];
-	[window release];
-	[super dealloc];
++(NSString *)dataFilePath: (NSString *)fileName {
+	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+	NSString *documentsDirectory = [paths objectAtIndex:0];
+	return [documentsDirectory stringByAppendingPathComponent:fileName];
 }
 
 @end
--- a/cocoaTouch/SDLOverrides/SDL_uikitview.m	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitview.m	Fri Jan 15 10:03:31 2010 +0000
@@ -166,7 +166,7 @@
 
 	// one tap - single click
 	if (1 == [touch tapCount] ) {
-		//SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].windowID, gestureStartPoint.x, gestureStartPoint.y);
+		SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].windowID, gestureStartPoint.x, gestureStartPoint.y);
 		HW_click();
 	}
 	
--- a/cocoaTouch/SettingsViewController.h	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SettingsViewController.h	Fri Jan 15 10:03:31 2010 +0000
@@ -14,6 +14,7 @@
 	UITextField *password;
 	UISwitch *musicOn;
 	UISwitch *effectsOn;
+	UISwitch *altDamageOn;
 	UISlider *volumeSlider;
 	UILabel *volumeLabel;
 }
@@ -21,6 +22,7 @@
 @property (nonatomic, retain) IBOutlet UITextField *password;
 @property (nonatomic, retain) IBOutlet UISwitch *musicOn;
 @property (nonatomic, retain) IBOutlet UISwitch *effectsOn;
+@property (nonatomic, retain) IBOutlet UISwitch *altDamageOn;
 @property (nonatomic, retain) IBOutlet UISlider *volumeSlider;
 @property (nonatomic, retain) IBOutlet UILabel *volumeLabel;
 
--- a/cocoaTouch/SettingsViewController.m	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SettingsViewController.m	Fri Jan 15 10:03:31 2010 +0000
@@ -7,21 +7,14 @@
 //
 
 #import "SettingsViewController.h"
-
+#import "SDL_uikitappdelegate.h"
 
 @implementation SettingsViewController
 
-@synthesize username, password, musicOn, effectsOn, volumeSlider, volumeLabel;
-
--(NSString *)dataFilePath: (NSString *)fileName {
-	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-	NSString *documentsDirectory = [paths objectAtIndex:0];
-	return [documentsDirectory stringByAppendingPathComponent:fileName];
-}
-
+@synthesize username, password, musicOn, effectsOn, altDamageOn, volumeSlider, volumeLabel;
 
 -(void) viewDidLoad {
-	NSString *filePath = [self dataFilePath:@"settings.plist"];
+	NSString *filePath = [SDLUIKitDelegate dataFilePath:@"settings.plist"];
 	
 	if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {	
 		NSUserDefaults *data = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
@@ -37,20 +30,28 @@
 		} else {
 			effectsOn.on = NO;
 		}
+		if (1 == [[data objectForKey:@"alternate"] intValue]) {
+			altDamageOn.on = YES;
+		} else {
+			altDamageOn.on = NO;
+		}		
+		
 		[volumeSlider setValue:[[data objectForKey:@"volume"] intValue] animated:NO];
+		
 		NSString *tmpVol = [[NSString alloc] initWithFormat:@"%d", (int) volumeSlider.value];
 		volumeLabel.text = tmpVol;
 		[tmpVol release];
+	} else {
+		[NSException raise:@"File NOT found" format:@"The file settings.plist was not found at %@", filePath];
 	}
-	
-	
 /*	
 	UIApplication *app = [UIApplication sharedApplication];
 	[[NSNotificationCenter defaultCenter] addObserver:self
 											 selector:@selector(applicationWillTerminate:)
 												 name:UIApplicationWillTerminateNotification
 											   object:app];
-*/	[super viewDidLoad];
+*/
+	[super viewDidLoad];
 }
 
 -(void) viewDidUnload {
@@ -58,6 +59,7 @@
 	self.password = nil;
 	self.musicOn = nil;
 	self.effectsOn = nil;
+	self.altDamageOn = nil;
 	self.volumeLabel = nil;
 	self.volumeSlider = nil;
 	[super viewDidUnload];
@@ -68,14 +70,16 @@
 	NSMutableDictionary *saveArray = [[NSMutableDictionary alloc] init];
 	NSString *tmpMus = (musicOn.on) ? @"1" : @"0";
 	NSString *tmpEff = (effectsOn.on) ? @"1" : @"0";
+	NSString *tmpAlt = (altDamageOn.on) ? @"1" : @"0";
 	
 	[saveArray setObject:username.text forKey:@"username"];
 	[saveArray setObject:password.text forKey:@"password"];
 	[saveArray setObject:tmpMus forKey:@"music"];
 	[saveArray setObject:tmpEff forKey:@"effects"];
+	[saveArray setObject:tmpAlt forKey:@"alternate"];
 	[saveArray setObject:volumeLabel.text forKey:@"volume"];
 	
-	[saveArray writeToFile:[self dataFilePath:@"settings.plist"] atomically:YES];
+	[saveArray writeToFile:[SDLUIKitDelegate dataFilePath:@"settings.plist"] atomically:YES];
 	[saveArray release];
 	[super viewWillDisappear:animated];
 }
@@ -88,11 +92,13 @@
 }
 */
 
+// makes the keyboard go away when background is tapped
 -(IBAction) backgroundTap: (id)sender {
 	[username resignFirstResponder];
 	[password resignFirstResponder];
 }
 
+// makes the keyboard go away when "Done" is tapped
 -(IBAction) textFieldDoneEditing: (id)sender {
 	[sender resignFirstResponder];
 }
@@ -110,6 +116,7 @@
 	[password release];
 	[musicOn release];
 	[effectsOn release];
+	[altDamageOn release];
 	[volumeLabel release];
 	[volumeSlider release];
     [super dealloc];
--- a/cocoaTouch/SettingsViewController.xib	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/SettingsViewController.xib	Fri Jan 15 10:03:31 2010 +0000
@@ -40,7 +40,7 @@
 				<int key="NSvFlags">292</int>
 				<object class="NSMutableArray" key="NSSubviews">
 					<bool key="EncodedWithXMLCoder">YES</bool>
-					<object class="IBUIImageView" id="239534914">
+					<object class="IBUIImageView" id="411150667">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">274</int>
 						<string key="NSFrameSize">{320, 431}</string>
@@ -53,7 +53,7 @@
 							<string key="NSResourceName">Background.png</string>
 						</object>
 					</object>
-					<object class="IBUITextField" id="64690547">
+					<object class="IBUITextField" id="52230916">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{130, 135}, {152, 31}}</string>
@@ -67,7 +67,7 @@
 						<object class="NSColor" key="IBUITextColor">
 							<int key="NSColorSpace">3</int>
 							<bytes key="NSWhite">MAA</bytes>
-							<object class="NSColorSpace" key="NSCustomColorSpace" id="679152831">
+							<object class="NSColorSpace" key="NSCustomColorSpace" id="6220105">
 								<int key="NSID">2</int>
 							</object>
 						</object>
@@ -79,7 +79,7 @@
 							<int key="IBUIReturnKeyType">9</int>
 						</object>
 					</object>
-					<object class="IBUITextField" id="46077344">
+					<object class="IBUITextField" id="809344278">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{130, 174}, {152, 31}}</string>
@@ -93,7 +93,7 @@
 						<object class="NSColor" key="IBUITextColor">
 							<int key="NSColorSpace">3</int>
 							<bytes key="NSWhite">MAA</bytes>
-							<reference key="NSCustomColorSpace" ref="679152831"/>
+							<reference key="NSCustomColorSpace" ref="6220105"/>
 						</object>
 						<bool key="IBUIClearsOnBeginEditing">YES</bool>
 						<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
@@ -104,7 +104,7 @@
 							<bool key="IBUISecureTextEntry">YES</bool>
 						</object>
 					</object>
-					<object class="IBUISlider" id="229592816">
+					<object class="IBUISlider" id="1157528">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{38, 373}, {243, 23}}</string>
@@ -118,10 +118,10 @@
 						<float key="IBUIMaxValue">100</float>
 						<bool key="IBUIContinuous">NO</bool>
 					</object>
-					<object class="IBUISwitch" id="1072985528">
+					<object class="IBUISwitch" id="846182137">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{188, 242}, {94, 27}}</string>
+						<string key="NSFrame">{{188, 224}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -130,10 +130,10 @@
 						<int key="IBUIContentVerticalAlignment">0</int>
 						<bool key="IBUIOn">YES</bool>
 					</object>
-					<object class="IBUISwitch" id="750512698">
+					<object class="IBUISwitch" id="101121478">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{188, 294}, {94, 27}}</string>
+						<string key="NSFrame">{{188, 279}, {94, 27}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<bool key="IBUIClipsSubviews">YES</bool>
@@ -142,7 +142,7 @@
 						<int key="IBUIContentVerticalAlignment">0</int>
 						<bool key="IBUIOn">YES</bool>
 					</object>
-					<object class="IBUILabel" id="811284943">
+					<object class="IBUILabel" id="939351608">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
 						<string key="NSFrame">{{56, 316}, {42, 21}}</string>
@@ -159,6 +159,18 @@
 						<int key="IBUIBaselineAdjustment">1</int>
 						<float key="IBUIMinimumFontSize">10</float>
 					</object>
+					<object class="IBUISwitch" id="140511032">
+						<reference key="NSNextResponder" ref="191373211"/>
+						<int key="NSvFlags">292</int>
+						<string key="NSFrame">{{188, 330}, {94, 27}}</string>
+						<reference key="NSSuperview" ref="191373211"/>
+						<bool key="IBUIOpaque">NO</bool>
+						<bool key="IBUIClipsSubviews">YES</bool>
+						<bool key="IBUIMultipleTouchEnabled">YES</bool>
+						<int key="IBUIContentHorizontalAlignment">0</int>
+						<int key="IBUIContentVerticalAlignment">0</int>
+						<bool key="IBUIOn">YES</bool>
+					</object>
 				</object>
 				<string key="NSFrameSize">{320, 431}</string>
 				<reference key="NSSuperview"/>
@@ -184,7 +196,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">username</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="64690547"/>
+						<reference key="destination" ref="52230916"/>
 					</object>
 					<int key="connectionID">13</int>
 				</object>
@@ -192,7 +204,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">password</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="46077344"/>
+						<reference key="destination" ref="809344278"/>
 					</object>
 					<int key="connectionID">14</int>
 				</object>
@@ -200,7 +212,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">musicOn</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="1072985528"/>
+						<reference key="destination" ref="846182137"/>
 					</object>
 					<int key="connectionID">15</int>
 				</object>
@@ -208,7 +220,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">effectsOn</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="750512698"/>
+						<reference key="destination" ref="101121478"/>
 					</object>
 					<int key="connectionID">16</int>
 				</object>
@@ -224,7 +236,7 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">textFieldDoneEditing:</string>
-						<reference key="source" ref="64690547"/>
+						<reference key="source" ref="52230916"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">20</int>
 					</object>
@@ -233,7 +245,7 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">textFieldDoneEditing:</string>
-						<reference key="source" ref="46077344"/>
+						<reference key="source" ref="809344278"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">20</int>
 					</object>
@@ -243,7 +255,7 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">volumeLabel</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="811284943"/>
+						<reference key="destination" ref="939351608"/>
 					</object>
 					<int key="connectionID">21</int>
 				</object>
@@ -251,14 +263,14 @@
 					<object class="IBCocoaTouchOutletConnection" key="connection">
 						<string key="label">volumeSlider</string>
 						<reference key="source" ref="372490531"/>
-						<reference key="destination" ref="229592816"/>
+						<reference key="destination" ref="1157528"/>
 					</object>
 					<int key="connectionID">23</int>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">sliderChanged:</string>
-						<reference key="source" ref="229592816"/>
+						<reference key="source" ref="1157528"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">3</int>
 					</object>
@@ -267,12 +279,20 @@
 				<object class="IBConnectionRecord">
 					<object class="IBCocoaTouchEventConnection" key="connection">
 						<string key="label">sliderChanged:</string>
-						<reference key="source" ref="229592816"/>
+						<reference key="source" ref="1157528"/>
 						<reference key="destination" ref="372490531"/>
 						<int key="IBEventType">4</int>
 					</object>
 					<int key="connectionID">26</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">altDamageOn</string>
+						<reference key="source" ref="372490531"/>
+						<reference key="destination" ref="140511032"/>
+					</object>
+					<int key="connectionID">28</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -288,13 +308,14 @@
 						<reference key="object" ref="191373211"/>
 						<object class="NSMutableArray" key="children">
 							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="239534914"/>
-							<reference ref="64690547"/>
-							<reference ref="46077344"/>
-							<reference ref="1072985528"/>
-							<reference ref="750512698"/>
-							<reference ref="229592816"/>
-							<reference ref="811284943"/>
+							<reference ref="411150667"/>
+							<reference ref="52230916"/>
+							<reference ref="809344278"/>
+							<reference ref="846182137"/>
+							<reference ref="101121478"/>
+							<reference ref="1157528"/>
+							<reference ref="939351608"/>
+							<reference ref="140511032"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -311,37 +332,42 @@
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">4</int>
-						<reference key="object" ref="239534914"/>
+						<reference key="object" ref="411150667"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">5</int>
-						<reference key="object" ref="64690547"/>
+						<reference key="object" ref="52230916"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">6</int>
-						<reference key="object" ref="46077344"/>
+						<reference key="object" ref="809344278"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">7</int>
-						<reference key="object" ref="229592816"/>
+						<reference key="object" ref="1157528"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">8</int>
-						<reference key="object" ref="1072985528"/>
+						<reference key="object" ref="846182137"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">9</int>
-						<reference key="object" ref="750512698"/>
+						<reference key="object" ref="101121478"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">20</int>
-						<reference key="object" ref="811284943"/>
+						<reference key="object" ref="939351608"/>
+						<reference key="parent" ref="191373211"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">27</int>
+						<reference key="object" ref="140511032"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
 				</object>
@@ -356,6 +382,7 @@
 					<string>1.IBEditorWindowLastContentRect</string>
 					<string>1.IBPluginDependency</string>
 					<string>20.IBPluginDependency</string>
+					<string>27.IBPluginDependency</string>
 					<string>4.IBPluginDependency</string>
 					<string>5.IBPluginDependency</string>
 					<string>6.IBPluginDependency</string>
@@ -377,6 +404,7 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -395,7 +423,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">26</int>
+			<int key="maxID">28</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -422,6 +450,7 @@
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>altDamageOn</string>
 							<string>effectsOn</string>
 							<string>musicOn</string>
 							<string>password</string>
@@ -433,6 +462,7 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>UISwitch</string>
 							<string>UISwitch</string>
+							<string>UISwitch</string>
 							<string>UITextField</string>
 							<string>UITextField</string>
 							<string>UILabel</string>
@@ -575,7 +605,7 @@
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="582665975">
+					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="311037604">
 						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
 					</object>
@@ -607,7 +637,7 @@
 				<object class="IBPartialClassDescription">
 					<string key="className">UIResponder</string>
 					<string key="superclassName">NSObject</string>
-					<reference key="sourceIdentifier" ref="582665975"/>
+					<reference key="sourceIdentifier" ref="311037604"/>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">UISearchBar</string>
@@ -644,14 +674,14 @@
 				<object class="IBPartialClassDescription">
 					<string key="className">UITextField</string>
 					<string key="superclassName">UIControl</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="795297786">
+					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="915667891">
 						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">UIView</string>
-					<reference key="sourceIdentifier" ref="795297786"/>
+					<reference key="sourceIdentifier" ref="915667891"/>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">UIView</string>
--- a/cocoaTouch/otherSrc/PascalImports.h	Thu Jan 14 16:46:50 2010 +0000
+++ b/cocoaTouch/otherSrc/PascalImports.h	Fri Jan 15 10:03:31 2010 +0000
@@ -38,4 +38,4 @@
 }
 #endif
 
-#endif
\ No newline at end of file
+#endif