# HG changeset patch # User koda # Date 1280066522 -7200 # Node ID 4c673e57f0d7eb07e25f3d372a6557bfd9e72a74 # Parent 3f7a95234d8a519e40fd2217b434612b6ab5fc6b use llvm to compile, don't preview map on wimpier devices, merge vsync, fix iphone launch image diff -r 3f7a95234d8a -r 4c673e57f0d7 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Sun Jul 25 01:59:41 2010 +0200 +++ b/hedgewars/hwengine.pas Sun Jul 25 16:02:02 2010 +0200 @@ -198,7 +198,6 @@ /////////////// {$IFDEF HWLIBRARY} procedure Game(gameArgs: arrayofpchar); cdecl; export; -var tmp_quality: LongInt; {$ELSE} procedure Game; {$ENDIF} @@ -211,7 +210,6 @@ {$IFDEF HWLIBRARY} cBits:= 32; cFullScreen:= false; - cVSyncInUse:= true; cTimerInterval:= 8; PathPrefix:= 'Data'; {$IFDEF DEBUGFILE} @@ -447,7 +445,7 @@ val(ParamStr(5), ipcPort); cFullScreen:= ParamStr(6) = '1'; isSoundEnabled:= ParamStr(7) = '1'; - cVSyncInUse:= ParamStr(8) = '1'; //unused + //cVSyncInUse:= ParamStr(8) = '1'; //merged with rqFlags //cWeaponTooltips:= ParamStr(9) = '1'; //merged with rqFlags cLocaleFName:= ParamStr(10); val(ParamStr(11), cInitVolume); @@ -462,7 +460,9 @@ cReducedQuality:= $FFFFFFFF xor rqLowRes else val(ParamStr(18), cReducedQuality); - + + if (ParamStr(8) = '0') then //HACK - ifcVSyncInUse not true, disable it + cReducedQuality:= cReducedQuality xor rqDesyncVBlank; if (ParamStr(9) = '0') then //HACK - if cWeaponTooltips not true, disable it cReducedQuality:= cReducedQuality xor rqTooltipsOff; end; diff -r 3f7a95234d8a -r 4c673e57f0d7 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Jul 25 01:59:41 2010 +0200 +++ b/hedgewars/uConsts.pas Sun Jul 25 16:02:02 2010 +0200 @@ -226,6 +226,7 @@ rqPlainSplash = $00000100; // no droplets rqClampLess = $00000200; // don't clamp textures rqTooltipsOff = $00000400; // tooltips are not drawn + rqDesyncVBlank= $00000800; // don't sync on vblank // image flags (for LoadImage()) ifNone = $00000000; // nothing special diff -r 3f7a95234d8a -r 4c673e57f0d7 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sun Jul 25 01:59:41 2010 +0200 +++ b/hedgewars/uMisc.pas Sun Jul 25 16:02:02 2010 +0200 @@ -80,7 +80,6 @@ cFullScreen : boolean = false; isSoundEnabled : boolean = true; isMusicEnabled : boolean = false; - cVSyncInUse : boolean = true; cLocaleFName : shortstring = 'en.txt'; cInitVolume : LongInt = 50; cTimerInterval : LongInt = 8; diff -r 3f7a95234d8a -r 4c673e57f0d7 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sun Jul 25 01:59:41 2010 +0200 +++ b/hedgewars/uStore.pas Sun Jul 25 16:02:02 2010 +0200 @@ -1133,11 +1133,13 @@ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); {$IFNDEF SDL13} // this attribute is default in 1.3 and must be enabled in MacOSX - if cVSyncInUse then + if (cReducedQuality and rqDesyncVBlank) <> 0 then + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) + else SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); {$IFDEF DARWIN} // fixes vsync in Snow Leopard - one := 1; + one:= 1; CGLSetParameter(CGLGetCurrentContext(), 222, @one); {$ENDIF} {$ENDIF} diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Classes/CommodityFunctions.h --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Sun Jul 25 16:02:02 2010 +0200 @@ -46,4 +46,5 @@ NSInteger randomPort (); void popError (const char *title, const char *message); void print_free_memory (); - +BOOL isPhone (); +NSString *modelType (); diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Classes/CommodityFunctions.m --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sun Jul 25 16:02:02 2010 +0200 @@ -7,6 +7,8 @@ // #import "CommodityFunctions.h" +#import +#import #import #import @@ -155,6 +157,19 @@ DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total); } -BOOL isPhone() { +BOOL isPhone () { return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone); } + +NSString *modelType () { + 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 = (char *)malloc(sizeof(char) * size); + // get the platform name + sysctlbyname("hw.machine", name, &size, NULL, 0); + NSString *modelId = [NSString stringWithUTF8String:name]; + free(name); + + return modelId; +} \ No newline at end of file diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Classes/GameSetup.m --- a/project_files/HedgewarsMobile/Classes/GameSetup.m Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Sun Jul 25 16:02:02 2010 +0200 @@ -6,9 +6,6 @@ // Copyright 2010 __MyCompanyName__. All rights reserved. // -#include -#include - #import "GameSetup.h" #import "SDL_uikitappdelegate.h" #import "SDL_net.h" @@ -374,15 +371,7 @@ const char **gameArgs = (const char**) malloc(sizeof(char *) * 10); NSInteger tmpQuality; - 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 = (char *)malloc(sizeof(char) * size); - // Get the platform name - sysctlbyname("hw.machine", name, &size, NULL, 0); - NSString *modelId = [[NSString alloc] initWithUTF8String:name]; - free(name); - + NSString *modelId = modelType(); if ([modelId hasPrefix:@"iPhone1"] || // = iPhone or iPhone 3G [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) // = iPod Touch or iPod Touch 2G tmpQuality = 0x00000001 | 0x00000002 | 0x00000040; // rqLowRes | rqBlurryLand | rqKillFlakes @@ -395,7 +384,6 @@ tmpQuality = 0; // full quality if (![modelId hasPrefix:@"iPad"]) // = disable tooltips unless iPad tmpQuality = tmpQuality | 0x00000400; - [modelId release]; gameArgs[9] = [[[NSNumber numberWithInteger:tmpQuality] stringValue] UTF8String]; diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Jul 25 16:02:02 2010 +0200 @@ -164,24 +164,32 @@ 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 + // remove the current preview and title [self.previewButton setImage:nil forState:UIControlStateNormal]; + [self.previewButton setTitle: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]; + // don't display preview on slower device, too slow and memory hog + NSString *modelId = modelType(); + if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) { + busy = NO; + [self.previewButton setTitle:NSLocalizedString(@"Preview not available",@"") forState:UIControlStateNormal]; + } else { + // prevent other events and add an activity while the preview is beign generated + [self turnOffWidgets]; + + // 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]; + } - // 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]; @@ -516,7 +524,13 @@ // initialize some "default" values self.sizeLabel.text = NSLocalizedString(@"All",@""); self.slider.value = 0.05f; - self.segmentedControl.selectedSegmentIndex = 0; + + // on slower device we show directly the static map + NSString *modelId = modelType(); + if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) + self.segmentedControl.selectedSegmentIndex = 1; + else + self.segmentedControl.selectedSegmentIndex = 0; self.templateFilterCommand = @"e$template_filter 0"; self.mazeSizeCommand = @"e$maze_size 0"; diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Jul 25 16:02:02 2010 +0200 @@ -30,8 +30,8 @@ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [self.tableView setBackgroundView:nil]; self.view.backgroundColor = [UIColor clearColor]; + self.tableView.separatorColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1]; } - self.tableView.separatorColor = [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xCB/255 blue:0 alpha:1]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } @@ -54,14 +54,12 @@ } - #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]; @@ -69,7 +67,6 @@ return [self.listOfWeapons count]; } - // Customize the appearance of table view cells. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Jul 25 01:59:41 2010 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Jul 25 16:02:02 2010 +0200 @@ -24,7 +24,7 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 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 */; }; + 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 611E03E711FA747C0077A41E /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 611E037C11FA74590077A41E /* libvorbis.a */; }; 611E0E5111FA92170077A41E /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 611E0E5011FA92130077A41E /* libfreetype.a */; }; 611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; }; @@ -109,9 +109,9 @@ 61798A14114AB65C00BA94A9 /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798A13114AB65600BA94A9 /* libSDL_ttf.a */; }; 61799289114AE08700BA94A9 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 61798A5E114AE08600BA94A9 /* Data */; }; 6183D83E11E2BCE200A88903 /* LI-ipad-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83C11E2BCE200A88903 /* LI-ipad-Landscape.png */; }; - 6183D83F11E2BCE200A88903 /* LI-iphone-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83D11E2BCE200A88903 /* LI-iphone-Landscape.png */; }; + 6183D83F11E2BCE200A88903 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83D11E2BCE200A88903 /* Default.png */; }; 619C09EA11E8B8D600F1DF16 /* title_small.png in Resources */ = {isa = PBXBuildFile; fileRef = 619C09E911E8B8D600F1DF16 /* title_small.png */; }; - 61A1188511683A8C00359010 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A117FE1168322700359010 /* CoreGraphics.framework */; }; + 61A1188511683A8C00359010 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A117FE1168322700359010 /* CoreGraphics.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 61A118D311683CD100359010 /* HedgewarsTitle.png in Resources */ = {isa = PBXBuildFile; fileRef = 611FD9CB1155A28C00C2203D /* HedgewarsTitle.png */; }; 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987FE114AA34C00BA94A9 /* uKeys.pas */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; @@ -806,7 +806,7 @@ 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; }; 61798A5E114AE08600BA94A9 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Data; sourceTree = ""; }; 6183D83C11E2BCE200A88903 /* LI-ipad-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "LI-ipad-Landscape.png"; path = "Resources/Icons/LI-ipad-Landscape.png"; sourceTree = ""; }; - 6183D83D11E2BCE200A88903 /* LI-iphone-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "LI-iphone-Landscape.png"; path = "Resources/Icons/LI-iphone-Landscape.png"; sourceTree = ""; }; + 6183D83D11E2BCE200A88903 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/Icons/Default.png; sourceTree = ""; }; 618736B8118CA28600123B23 /* GearDrawing.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GearDrawing.inc; path = ../../hedgewars/GearDrawing.inc; sourceTree = SOURCE_ROOT; }; 619C09E911E8B8D600F1DF16 /* title_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = title_small.png; path = "Resources/Frontend-iPhone/title_small.png"; sourceTree = ""; }; 61A117FE1168322700359010 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -1241,7 +1241,7 @@ isa = PBXGroup; children = ( 6183D83C11E2BCE200A88903 /* LI-ipad-Landscape.png */, - 6183D83D11E2BCE200A88903 /* LI-iphone-Landscape.png */, + 6183D83D11E2BCE200A88903 /* Default.png */, 61F7A43111E290650040BA66 /* Icon-72.png */, 61F7A43211E290650040BA66 /* Icon-Small-50.png */, 61F7A43311E290650040BA66 /* Icon-Small.png */, @@ -1997,7 +1997,7 @@ 61F7A43D11E290650040BA66 /* Icon@2x.png in Resources */, 61F7A43E11E290650040BA66 /* iTunesArtwork.png in Resources */, 6183D83E11E2BCE200A88903 /* LI-ipad-Landscape.png in Resources */, - 6183D83F11E2BCE200A88903 /* LI-iphone-Landscape.png in Resources */, + 6183D83F11E2BCE200A88903 /* Default.png in Resources */, 619C09EA11E8B8D600F1DF16 /* title_small.png in Resources */, 6129B9F711EFB04D0017E305 /* denied.png in Resources */, 611E0EE711FB20610077A41E /* ammoButton.png in Resources */, @@ -2209,7 +2209,7 @@ GCC_OPTIMIZATION_LEVEL = 2; GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = ""; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -2228,7 +2228,7 @@ PREBINDING = NO; PROVISIONING_PROFILE = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = NO; VALID_ARCHS = "armv7 armv6"; @@ -2327,7 +2327,7 @@ ); GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = ""; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -2344,7 +2344,7 @@ "-Wl,-no_order_inits", ); PREBINDING = NO; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = NO; VALID_ARCHS = "armv7 armv6"; @@ -2529,7 +2529,7 @@ GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = ""; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -2546,7 +2546,7 @@ "-Wl,-no_order_inits", ); PREBINDING = NO; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = NO; VALID_ARCHS = "armv7 armv6"; @@ -2572,7 +2572,7 @@ GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = ""; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -2591,7 +2591,7 @@ PREBINDING = NO; PROVISIONING_PROFILE = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos3.2; + SDKROOT = iphoneos4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = NO; VALID_ARCHS = "armv7 armv6"; diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Resources/Icons/Default.png Binary file project_files/HedgewarsMobile/Resources/Icons/Default.png has changed diff -r 3f7a95234d8a -r 4c673e57f0d7 project_files/HedgewarsMobile/Resources/Icons/LI-iphone-Landscape.png Binary file project_files/HedgewarsMobile/Resources/Icons/LI-iphone-Landscape.png has changed