diff --git a/source/xcode/English.lproj/InfoPlist.strings b/source/xcode/English.lproj/InfoPlist.strings index 7b7f1d1d..972dc545 100644 Binary files a/source/xcode/English.lproj/InfoPlist.strings and b/source/xcode/English.lproj/InfoPlist.strings differ diff --git a/source/xcode/English.lproj/Localizable.strings b/source/xcode/English.lproj/Localizable.strings new file mode 100644 index 00000000..3282d979 --- /dev/null +++ b/source/xcode/English.lproj/Localizable.strings @@ -0,0 +1,21 @@ +/* note ':s' becomes 'assaultcube' */ + +/* tabs */ +"Main" = "Main"; +"Keys" = "Keys"; +"Server" = "Server"; + +"Ok" = "Ok"; +"Cancel" = "Cancel"; +"Start" = "Start"; +"Stop" = "Stop"; +"ServerAlertMesg" = "Error - Can't launch server"; + +"ClientAlertTitle" = "Can't start :s"; +"ClientAlertMesg" = "Try moving the game folder contain :s so that the path doesn't contain weird characters, or start :s manually."; + +"InitAlertTitle" = "Invalid installation"; +"InitAlertMesg" = "Cannot find game data and executable"; + +"FileAlertTitle" = "Invalid file location"; +"FileAlertMesg" = "Can only load files that are within the :s home or the original :s package folder. Do you want to show this folder?"; diff --git a/source/xcode/Launcher.m b/source/xcode/Launcher.m index f13f2d6c..fc169af4 100644 --- a/source/xcode/Launcher.m +++ b/source/xcode/Launcher.m @@ -18,8 +18,9 @@ #define kMaxDisplays 16 -//If you make a MOD then please change this, the bundle indentifier, the file extensions (.ogz, .dmo), and the url registration. -#define kSAUERBRATEN @"assaultcube" +//If you make a MOD then please change this, the bundle indentifier, the file extensions (.cgz, .dmo), and the url registration. +#define kASSAULTCUBE @"assaultcube" +#define kUSERCONFGIDIR @"assaultcube_1.1" //tab names, i.e. image names (text is localised) #define tkMAIN @"Main" @@ -33,7 +34,7 @@ - (NSString*)expand { NSMutableString *str = [NSMutableString string]; [str setString:self]; - [str replaceOccurrencesOfString:@":s" withString:kSAUERBRATEN options:0 range:NSMakeRange(0, [str length])]; + [str replaceOccurrencesOfString:@":s" withString:kASSAULTCUBE options:0 range:NSMakeRange(0, [str length])]; return str; } @end @@ -71,7 +72,7 @@ [path release]; [super dealloc]; } -- (NSString*)path { return (demo ? [NSString stringWithFormat:@"-xdemo \"%@\"", path] : path); } // minor hack +- (NSString*)path { return (demo ? [NSString stringWithFormat:@"--loaddemo=%@", path] : path); } // minor hack - (NSString*)name { return [path lastPathComponent]; } - (NSImage*)image { @@ -234,7 +235,7 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) } -/* directory where user files are kept - typically /Users//Application Support/sauerbraten */ +/* directory where user files are kept - typically /Users//Application Support/assaultcube_major.minor */ + (NSString*)userdir { FSRef folder; @@ -243,7 +244,7 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) CFURLRef url = CFURLCreateFromFSRef(kCFAllocatorDefault, &folder); path = [(NSURL *)url path]; CFRelease(url); - path = [path stringByAppendingPathComponent:kSAUERBRATEN]; + path = [path stringByAppendingPathComponent:kUSERCONFGIDIR]; NSFileManager *fm = [NSFileManager defaultManager]; if(![fm fileExistsAtPath:path]) [fm createDirectoryAtPath:path attributes:nil]; //ensure it exists } @@ -457,8 +458,7 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) /* * nil will just launch the fps game - * "-rpg" will launch the rpg demo - * "-x.." will launch and run commands + * "-e.." will launch and run commands * otherwise we are specifying a map to play */ - (BOOL)playFile:(id)filename @@ -468,21 +468,42 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) NSArray *res = [[resolutions titleOfSelectedItem] componentsSeparatedByString:@" x "]; NSMutableArray *args = [NSMutableArray array]; - [args addObject:[NSString stringWithFormat:@"--home=%@", [Launcher userdir]]]; - [args addObject:@"--init"]; + [args addObject:[NSString stringWithFormat:@"--home=%@", [Launcher userdir]]]; + [args addObject:@"--init"]; [args addObject:[NSString stringWithFormat:@"-w%@", [res objectAtIndex:0]]]; [args addObject:[NSString stringWithFormat:@"-h%@", [res objectAtIndex:1]]]; [args addObject:@"-z32"]; //otherwise seems to have a fondness to use -z16 which looks crap - - if([defs integerForKey:dkFULLSCREEN] == 0) - [args addObject:@"-t0"]; - else - [args addObject:@"-t1"]; [args addObject:[NSString stringWithFormat:@"-a%d", [defs integerForKey:dkFSAA]]]; - - if ([stencil state] == NSOnState) [args addObject:@"-s8"]; + + if([defs integerForKey:dkFULLSCREEN] == 0) + [args addObject:@"-t0"]; + else + [args addObject:@"-t1"]; + + if ([stencil state] == NSOnState) + [args addObject:@"-s8"]; + + NSMutableArray *cmds = [NSMutableArray array]; + + if(filename) + { + if([filename hasPrefix:@"-e"]) + [cmds addObject:[filename substringFromIndex:2]]; + if([filename hasPrefix:@"--loaddemo"]) + [args addObject:filename]; + else + [args addObject:[NSString stringWithFormat:@"--loadmap=%@", filename]]; + } + if([cmds count] > 0) + { + NSString *script = [cmds objectAtIndex:0]; + int i; + for(i = 1; i < [cmds count]; i++) script = [NSString stringWithFormat:@"%@;%@", script, [cmds objectAtIndex:i]]; + [args addObject:[NSString stringWithFormat:@"-e%@", script]]; + } + NSEnumerator *e = [[[defs nonNullStringForKey:dkADVANCEDOPTS] componentsSeparatedByString:@" "] objectEnumerator]; NSString *opt; while(opt = [e nextObject]) if([opt length] != 0) [args addObject:opt]; //skip empty ones @@ -534,7 +555,7 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) [self initToolBar]; [window setBackgroundColor:[NSColor colorWithDeviceRed:0.90 green:0.90 blue:0.90 alpha:1.0]]; //Apples 'mercury' crayon color - //from the plist we determine that dmo->Viewer, and ogz->Editor + //from the plist we determine that dmo->Viewer, and cgz->Editor fileRoles = [[NSMutableDictionary dictionary] retain]; NSEnumerator *types = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDocumentTypes"] objectEnumerator]; NSDictionary *type; @@ -593,7 +614,7 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) [self killServer]; } -//we register 'ogz' and 'dmo' as doc types +//we register 'cgz' and 'dmo' as doc types - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { NSString *role = [fileRoles objectForKey:[filename pathExtension]]; @@ -603,12 +624,15 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) int i; for(i = 0; i < 2; i++) { NSString *pkg = (i == 0) ? [Launcher cwd] : [Launcher userdir]; - if(!demo) pkg = [pkg stringByAppendingPathComponent:@"packages"]; + if(!demo) pkg = [pkg stringByAppendingPathComponent:@"packages/maps/"]; if([filename hasPrefix:pkg]) - return [self playFile:(demo ? [NSString stringWithFormat:@"-xdemo \"%@\"", filename] : filename)]; + { + filename = [filename lastPathComponent]; //chop off extension + return [self playFile:(demo ? [NSString stringWithFormat:@"--loaddemo=%@", filename] : filename)]; + } } NSBeginCriticalAlertSheet( - [NSLocalizedString(@"FileAlertMesg", @"") expand], NSLocalizedString(@"Ok", @""), NSLocalizedString(@"Cancel", @""), nil, + [NSLocalizedString(@"FileAlertTitle", @"") expand], NSLocalizedString(@"Ok", @""), NSLocalizedString(@"Cancel", @""), nil, window, self, @selector(openPackageFolder:returnCode:contextInfo:), nil, nil, [NSLocalizedString(@"FileAlertMesg", @"") expand]); return NO; @@ -620,12 +644,12 @@ static int numberForKey(CFDictionaryRef desc, CFStringRef key) [self openUserdir:nil]; } -//we register 'sauerbraten' as a url scheme +//we register 'assaultcube' as a url scheme - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]]; if(!url) return; - [self playFile:[NSString stringWithFormat:@"-xconnect %@", [url host]]]; + [self playFile:[NSString stringWithFormat:@"-econnect %@", [url host]]]; } #pragma mark interface actions diff --git a/source/xcode/assaultcube.plist b/source/xcode/assaultcube.plist index b402f11f..c8cc1b7d 100644 --- a/source/xcode/assaultcube.plist +++ b/source/xcode/assaultcube.plist @@ -24,7 +24,7 @@ CFBundleSignature ???? CFBundleVersion - 1.1.x + 1.1.x.x NSPrincipalClass NSApplication diff --git a/source/xcode/assaultcube.xcodeproj/project.pbxproj b/source/xcode/assaultcube.xcodeproj/project.pbxproj index c15f3ff6..95d96dfe 100644 --- a/source/xcode/assaultcube.xcodeproj/project.pbxproj +++ b/source/xcode/assaultcube.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ 665CDD180AFE7ED80030D605 /* botmanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 665CDCE60AFE7ED80030D605 /* botmanager.cpp */; }; 66899E700C1485E200927C34 /* ConsoleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 66899E6E0C1485E200927C34 /* ConsoleView.m */; }; 66899E770C14862300927C34 /* macutils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 66899E760C14862300927C34 /* macutils.mm */; }; + 9EAE4C10120F2F370041E6E4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9EAE4BD8120F2D0A0041E6E4 /* Localizable.strings */; }; 9EB8171A11ED9AEF00799589 /* INTL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EB8171211ED9AEF00799589 /* INTL.framework */; }; 9EB8171B11ED9AEF00799589 /* JPEG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EB8171311ED9AEF00799589 /* JPEG.framework */; }; 9EB8171C11ED9AEF00799589 /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EB8171411ED9AEF00799589 /* Ogg.framework */; }; @@ -89,7 +90,6 @@ B914CEDA11CAC42F009BA307 /* worldocull.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B914CE8B11CAC42F009BA307 /* worldocull.cpp */; }; B914CEDB11CAC42F009BA307 /* worldrender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B914CE8C11CAC42F009BA307 /* worldrender.cpp */; }; B914CEDC11CAC42F009BA307 /* zip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B914CE8D11CAC42F009BA307 /* zip.cpp */; }; - B94198A509207E810029DAD1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; B94198A809207E810029DAD1 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = F5A47A9E01A0483001D3D55B /* SDLMain.m */; }; B94198C309207E810029DAD1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; B94198C409207E810029DAD1 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2F67ED704C74A3F00A80002 /* OpenGL.framework */; }; @@ -159,6 +159,7 @@ 66899EA90C14887F00927C34 /* Keys.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Keys.gif; sourceTree = ""; }; 66899EAA0C14887F00927C34 /* Main.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Main.gif; sourceTree = ""; }; 66899EAB0C14887F00927C34 /* Server.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Server.gif; sourceTree = ""; }; + 9EAE4BD9120F2D0A0041E6E4 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; 9EB8171211ED9AEF00799589 /* INTL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = INTL.framework; path = Frameworks/INTL.framework; sourceTree = ""; }; 9EB8171311ED9AEF00799589 /* JPEG.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JPEG.framework; path = Frameworks/JPEG.framework; sourceTree = ""; }; 9EB8171411ED9AEF00799589 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = Frameworks/Ogg.framework; sourceTree = ""; }; @@ -360,13 +361,14 @@ 9EB817DE11EDA3A300799589 /* assaultcube.icns */, 9EB8183711EDA6EE00799589 /* assaultcube.plist */, 66899EA80C14887F00927C34 /* Help.tiff */, - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 66899EA90C14887F00927C34 /* Keys.gif */, 9EB8183811EDA6EE00799589 /* launcher.plist */, 66899EAA0C14887F00927C34 /* Main.gif */, B96D0D5A0920971300B6C936 /* MainMenu.nib */, B975E7F30EBCC3A200880D5D /* map.icns */, 66899EAB0C14887F00927C34 /* Server.gif */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 9EAE4BD8120F2D0A0041E6E4 /* Localizable.strings */, ); name = Resources; sourceTree = ""; @@ -564,7 +566,6 @@ buildActionMask = 2147483647; files = ( 9EB8181D11EDA56D00799589 /* assaultcube.icns in Resources */, - B94198A509207E810029DAD1 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -574,12 +575,13 @@ files = ( 9EB8188511EDACDB00799589 /* assaultcube.icns in Resources */, 9EB8188611EDACDB00799589 /* Help.tiff in Resources */, - B90357B509D09B9D002C9DC7 /* InfoPlist.strings in Resources */, 9EB8188711EDACDB00799589 /* Keys.gif in Resources */, 9EB8188811EDACDB00799589 /* Main.gif in Resources */, B96D0D630920971300B6C936 /* MainMenu.nib in Resources */, 9EB8188911EDACDB00799589 /* map.icns in Resources */, 9EB8188A11EDACDB00799589 /* Server.gif in Resources */, + B90357B509D09B9D002C9DC7 /* InfoPlist.strings in Resources */, + 9EAE4C10120F2F370041E6E4 /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -597,7 +599,7 @@ ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "echo $TARGET_BUILD_DIR\ncd $TARGET_BUILD_DIR\n\n#ensure old package is gone\nrm -f assaultcube.dmg\n\n#make the directory which our disk image will be made of\n#use /tmp as a destination because copying ourself (xcode folder) whilst compling causes the dog to chase its tail\nACPKG=`mktemp -d /tmp/acpkg.XXXXXX` || exit 1\n\n#leave indicator of where temp directory is in case things break\nln -sf $ACPKG $TARGET_BUILD_DIR/acpkg\n\n#copy launcher\n/Developer/Tools/CpMac -r $TARGET_BUILD_DIR/launcher.app $ACPKG/AssaultCube.app\n\nHELPDIR=$ACPKG/AssaultCube.app/Contents/Resources/help/\nGAMEDIR=$ACPKG/AssaultCube.app/Contents/gamedata\nmkdir $GAMEDIR\nmkdir $HELPDIR\n\n#copy assaultcube\n/Developer/Tools/CpMac -r $TARGET_BUILD_DIR/assaultcube.app $GAMEDIR/\nstrip -u -r \"$GAMEDIR/assaultcube.app/Contents/MacOS/assaultcube\"\n\n#copy readme and data and remove unneccesary stuff\n/Developer/Tools/CpMac -r $SRCROOT/../../README.html $HELPDIR/\n/Developer/Tools/CpMac -r $SRCROOT/../../docs $HELPDIR/\n/Developer/Tools/CpMac -r $SRCROOT/../../bot $GAMEDIR/\n/Developer/Tools/CpMac -r $SRCROOT/../../config $GAMEDIR/\n/Developer/Tools/CpMac -r $SRCROOT/../../packages $GAMEDIR/\n/Developer/Tools/CpMac -r $SRCROOT/../../source $ACPKG/sourcecode\nfind -d $ACPKG -name \"shadows.dat\" -exec rm -rf {} \\;\nfind -d $ACPKG -name \"CVS\" -exec rm -rf {} \\;\nfind -d $ACPKG -name \".svn\" -exec rm -rf {} \\;\nfind $ACPKG -name \".DS_Store\" -exec rm -f {} \\;\nrm -rf $ACPKG/sourcecode/xcode/build\nrm -rf $ACPKG/sourcecode/xcode/Frameworks/*\nrm -rf $ACPKG/sourcecode/vcpp\nrm -f $GAMEDIR/config/saved.cfg\nrm -f $GAMEDIR/config/init.cfg\nrm -f $GAMEDIR/config/servers.cfg\n\nrm -rf $HELPDIR/docs/autogen/\nmkdir $GAMEDIR/screenshots\nmkdir $GAMEDIR/demos\nmkdir $GAMEDIR/mods\n\n#add alias to readme\n/usr/bin/osascript <CFBundleSignature ???? CFBundleVersion - 1.1.x + 1.1.x.x + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + AssaultCubeServer + CFBundleURLSchemes + + assaultcube + + + NSMainNibFile MainMenu NSPrincipalClass