--- a/hedgewars/GSHandlers.inc Fri Nov 12 18:57:36 2010 -0500
+++ b/hedgewars/GSHandlers.inc Sat Nov 13 03:26:14 2010 +0100
@@ -761,15 +761,16 @@
);
if trail <> nil then
begin
- trail^.dX := Gear^.X.QWordValue / _1.QWordValue;
- trail^.dY := Gear^.Y.QWordValue / _1.QWordValue;
+ // http://mantis.freepascal.org/view.php?id=17714 hits again
+ trail^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
+ trail^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
// reached edge of land. assume infinite beam. Extend it way out past camera
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0)
or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
begin
- trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / _1.QWordValue;
- trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / _1.QWordValue;
+ trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
+ trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
end;
trail^.Timer := 200;
--- a/hedgewars/GearDrawing.inc Fri Nov 12 18:57:36 2010 -0500
+++ b/hedgewars/GearDrawing.inc Sat Nov 13 03:26:14 2010 +0100
@@ -4,7 +4,6 @@
sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction
dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change
defaultPos, HatVisible: boolean;
- VertexBuffer: array [0..1] of TVertex2f;
HH: PHedgehog;
CurWeapon: PAmmo;
begin
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Sat Nov 13 03:26:14 2010 +0100
@@ -60,9 +60,6 @@
#define DEFAULT_NETGAME_PORT 46631
-void createTeamNamed (NSString *nameWithoutExt);
-void createWeaponNamed (NSString *nameWithoutExt, int type);
-void createSchemeNamed (NSString *nameWithoutExt);
void print_free_memory (void);
void playSound (NSString *snd);
void popError (const char *title, const char *message);
@@ -73,3 +70,5 @@
NSArray *getAvailableColors (void);
UILabel *createBlueLabel (NSString *title, CGRect frame);
UILabel *createLabelWithParams (NSString *title, CGRect frame, CGFloat borderWidth, UIColor *borderColor, UIColor *backgroundColor);
+
+CGSize PSPNGSizeFromMetaData (NSString *aFileName);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sat Nov 13 03:26:14 2010 +0100
@@ -28,169 +28,6 @@
#import "AudioToolbox/AudioToolbox.h"
#import "PascalImports.h"
-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: HW_getMaxNumberOfHogs()];
-
- for (int i = 0; i < HW_getMaxNumberOfHogs(); 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",
- @"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 createWeaponNamed (NSString *nameWithoutExt, int type) {
- NSString *weaponsDirectory = WEAPONS_DIRECTORY();
-
- if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) {
- [[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory
- withIntermediateDirectories:NO
- attributes:nil
- error:NULL];
- }
-
- NSDictionary *theWeapon = nil;
- switch (type) {
- case 0: //default
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"9391929422199121032235111001201000000211110101011",@"ammostore_initialqt",
- @"0405040541600655546554464776576666666155510101117",@"ammostore_probability",
- @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
- @"1311110312111111123114111111111111111211111101111",@"ammostore_crate", nil];
- break;
- case 1: //crazy
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"9999999999999999992999999999999999299999999909999",@"ammostore_initialqt",
- @"1111110111111111111111111111111111111111111101111",@"ammostore_probability",
- @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
- @"1311110312111111123114111111111111111211110101111",@"ammostore_crate", nil];
- break;
- case 2: //pro mode
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"9090009000000000000009000000000000000000000000000",@"ammostore_initialqt",
- @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
- @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
- @"1111111111111111111111111111111111111111100101111",@"ammostore_crate", nil];
- break;
- case 3: //shoppa
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"0000009900000000000000000000000000000000000000000",@"ammostore_initialqt",
- @"4444410044244402210112121222422000000002000400010",@"ammostore_probability",
- @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
- @"1111111111111111111111111111111111111111101101111",@"ammostore_crate", nil];
- break;
- case 4: //clean slate
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"1010009000010000011000000000000000000000000000001",@"ammostore_initialqt",
- @"0405040541600655546554464776576666666155510101117",@"ammostore_probability",
- @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
- @"1311110312111111123114111111111111111211111101111",@"ammostore_crate", nil];
- break;
- case 5: //minefield
- theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
- @"0000009900090000000300000000000000000000000000000",@"ammostore_initialqt",
- @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
- @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
- @"1111111111111111111111111111111111111111111101111",@"ammostore_crate", nil];
- break;
- default:
- NSLog(@"Nope");
- break;
- }
-
- NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt];
-
- [theWeapon writeToFile:weaponFile atomically:YES];
- [weaponFile release];
- [theWeapon release];
-}
-
-void createSchemeNamed (NSString *nameWithoutExt) {
- NSString *schemesDirectory = SCHEMES_DIRECTORY();
-
- if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
- [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
- withIntermediateDirectories:NO
- attributes:nil
- error:NULL];
- }
-
- NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects:
- [NSNumber numberWithInt:100], //initialhealth
- [NSNumber numberWithInt:45], //turntime
- [NSNumber numberWithInt:100], //damagemodifier
- [NSNumber numberWithInt:15], //suddendeathtimeout
- [NSNumber numberWithInt:47], //waterrise
- [NSNumber numberWithInt:5], //healthdecrease
- [NSNumber numberWithInt:5], //cratedrops
- [NSNumber numberWithInt:35], //healthprob
- [NSNumber numberWithInt:25], //healthamount
- [NSNumber numberWithInt:3], //minestime
- [NSNumber numberWithInt:4], //minesnumber
- [NSNumber numberWithInt:0], //dudmines
- [NSNumber numberWithInt:2], //explosives
- nil];
-
- NSMutableArray *gamemodArray= [[NSMutableArray 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], //resethealth
- [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 numberWithBool:NO], //aisurvival
- [NSNumber numberWithBool:NO], //infattack
- [NSNumber numberWithBool:NO], //resetweaps
- [NSNumber numberWithBool:NO], //perhogammo
- nil];
-
- NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
- basicArray,@"basic",
- gamemodArray,@"gamemod",
- nil];
- [gamemodArray release];
- [basicArray release];
-
- NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt];
-
- [theScheme writeToFile:schemeFile atomically:YES];
- [schemeFile release];
- [theScheme release];
-}
-
BOOL inline rotationManager (UIInterfaceOrientation interfaceOrientation) {
if (IS_IPAD())
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
@@ -305,3 +142,47 @@
return theLabel;
}
+
+// this routine checks for the PNG size without loading it in memory
+// https://github.com/steipete/PSFramework/blob/master/PSFramework%20Version%200.3/PhotoshopFramework/PSMetaDataFunctions.m
+CGSize PSPNGSizeFromMetaData (NSString *aFileName) {
+ // File Name to C String.
+ const char *fileName = [aFileName UTF8String];
+ // source file
+ FILE *infile = fopen(fileName, "rb");
+ if (infile == NULL) {
+ DLog(@"Can't open the file: %@", aFileName);
+ return CGSizeZero;
+ }
+
+ // Bytes Buffer.
+ unsigned char buffer[30];
+ // Grab Only First Bytes.
+ fread(buffer, 1, 30, infile);
+ // Close File.
+ fclose(infile);
+
+ // PNG Signature.
+ unsigned char png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+
+ // Compare File signature.
+ if ((int)(memcmp(&buffer[0], &png_signature[0], 8))) {
+ DLog(@"The file (%@) is not a PNG file", aFileName);
+ return CGSizeZero;
+ }
+
+ // Calc Sizes. Isolate only four bytes of each size (width, height).
+ int width[4];
+ int height[4];
+ for (int d = 16; d < (16 + 4); d++) {
+ width[d-16] = buffer[d];
+ height[d-16] = buffer[d+4];
+ }
+
+ // Convert bytes to Long (Integer)
+ long resultWidth = (width[0] << (int)24) | (width[1] << (int)16) | (width[2] << (int)8) | width[3];
+ long resultHeight = (height[0] << (int)24) | (height[1] << (int)16) | (height[2] << (int)8) | height[3];
+
+ // Return Size.
+ return CGSizeMake(resultWidth,resultHeight);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.h Sat Nov 13 03:26:14 2010 +0100
@@ -0,0 +1,26 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.
+ *
+ * File created on 12/11/2010.
+ */
+
+
+#import <Foundation/Foundation.h>
+
+void createTeamNamed (NSString *nameWithoutExt);
+void createWeaponNamed (NSString *nameWithoutExt, int type);
+void createSchemeNamed (NSString *nameWithoutExt);
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Sat Nov 13 03:26:14 2010 +0100
@@ -0,0 +1,201 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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.
+ *
+ * File created on 12/11/2010.
+ */
+
+
+#import "CreationChamber.h"
+
+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: HW_getMaxNumberOfHogs()];
+
+ for (int i = 0; i < HW_getMaxNumberOfHogs(); 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",
+ @"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 createWeaponNamed (NSString *nameWithoutExt, int type) {
+ NSString *weaponsDirectory = WEAPONS_DIRECTORY();
+
+ if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) {
+ [[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory
+ withIntermediateDirectories:NO
+ attributes:nil
+ error:NULL];
+ }
+
+ NSDictionary *theWeapon = nil;
+ switch (type) {
+ case 0: //default
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"93919294221991210322351110012010000002111101010111",@"ammostore_initialqt",
+ @"04050405416006555465544647765766666661555101011154",@"ammostore_probability",
+ @"00000000000002055000000400070040000000002000000006",@"ammostore_delay",
+ @"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil];
+ break;
+ case 1: //crazy
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"99999999999999999929999999999999992999999999099999",@"ammostore_initialqt",
+ @"11111101111111111111111111111111111111111111011111",@"ammostore_probability",
+ @"00000000000000000000000000000000000000000000000000",@"ammostore_delay",
+ @"13111103121111111231141111111111111112111101011111",@"ammostore_crate", nil];
+ break;
+ case 2: //pro mode
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"90900090000000000000090000000000000000000000000000",@"ammostore_initialqt",
+ @"00000000000000000000000000000000000000000000000000",@"ammostore_probability",
+ @"00000000000002055000000400070040000000002000000000",@"ammostore_delay",
+ @"11111111111111111111111111111111111111111001011111",@"ammostore_crate", nil];
+ break;
+ case 3: //shoppa
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"00000099000000000000000000000000000000000000000000",@"ammostore_initialqt",
+ @"44444100442444022101121212224220000000020004000100",@"ammostore_probability",
+ @"00000000000000000000000000000000000000000000000000",@"ammostore_delay",
+ @"11111111111111111111111111111111111111111011011111",@"ammostore_crate", nil];
+ break;
+ case 4: //clean slate
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"10100090000100000110000000000000000000000000000010",@"ammostore_initialqt",
+ @"04050405416006555465544647765766666661555101011154",@"ammostore_probability",
+ @"00000000000002055000000400070040000000002000000000",@"ammostore_delay",
+ @"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil];
+ break;
+ case 5: //minefield
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"00000099000900000003000000000000000000000000000000",@"ammostore_initialqt",
+ @"00000000000000000000000000000000000000000000000000",@"ammostore_probability",
+ @"00000000000002055000000400070040000000002000000000",@"ammostore_delay",
+ @"11111111111111111111111111111111111111111111011111",@"ammostore_crate", nil];
+ break;
+ case 6: //thinking with portals
+ theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"90000090020000000021000000000000001100000900000000",@"ammostore_initialqt",
+ @"04050405416006555465544647765766666661555101011154",@"ammostore_probability",
+ @"00000000000002055000000400070040000000002000000006",@"ammostore_delay",
+ @"13111103121111111231141111111111111112111111011111",@"ammostore_crate", nil];
+ break;
+ default:
+ NSLog(@"Nope");
+ break;
+ }
+
+ NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt];
+
+ [theWeapon writeToFile:weaponFile atomically:YES];
+ [weaponFile release];
+ [theWeapon release];
+}
+
+void createSchemeNamed (NSString *nameWithoutExt) {
+ NSString *schemesDirectory = SCHEMES_DIRECTORY();
+
+ if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
+ [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
+ withIntermediateDirectories:NO
+ attributes:nil
+ error:NULL];
+ }
+
+ NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects:
+ [NSNumber numberWithInt:100], //initialhealth
+ [NSNumber numberWithInt:45], //turntime
+ [NSNumber numberWithInt:100], //damagemodifier
+ [NSNumber numberWithInt:15], //suddendeathtimeout
+ [NSNumber numberWithInt:47], //waterrise
+ [NSNumber numberWithInt:5], //healthdecrease
+ [NSNumber numberWithInt:5], //cratedrops
+ [NSNumber numberWithInt:35], //healthprob
+ [NSNumber numberWithInt:25], //healthamount
+ [NSNumber numberWithInt:3], //minestime
+ [NSNumber numberWithInt:4], //minesnumber
+ [NSNumber numberWithInt:0], //dudmines
+ [NSNumber numberWithInt:2], //explosives
+ nil];
+
+ NSMutableArray *gamemodArray= [[NSMutableArray 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], //resethealth
+ [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 numberWithBool:NO], //aisurvival
+ [NSNumber numberWithBool:NO], //infattack
+ [NSNumber numberWithBool:NO], //resetweaps
+ [NSNumber numberWithBool:NO], //perhogammo
+ [NSNumber numberWithBool:NO], //nowind
+ nil];
+
+ NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+ basicArray,@"basic",
+ gamemodArray,@"gamemod",
+ nil];
+ [gamemodArray release];
+ [basicArray release];
+
+ NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt];
+
+ [theScheme writeToFile:schemeFile atomically:YES];
+ [schemeFile release];
+ [theScheme release];
+}
--- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Sat Nov 13 03:26:14 2010 +0100
@@ -37,6 +37,7 @@
textField.returnKeyType = UIReturnKeyDone;
textField.adjustsFontSizeToFitWidth = YES;
textField.userInteractionEnabled = YES;
+ textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
[textField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit];
[self.contentView addSubview:textField];
@@ -76,8 +77,6 @@
skew +=2;
}
- // sometimes the bold property gets lost
- textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
textField.frame = CGRectMake(boundsX+offset+10, skew+10, 300, [UIFont labelFontSize] + 4);
}
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -144,6 +144,7 @@
[self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
level = 0;
}
+ [sections release];
DLog(@"New level is %d",level);
for (NSMutableDictionary *hog in hogs)
@@ -151,8 +152,6 @@
[self.tableView reloadData];
[[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
-
- [sections release];
}
@@ -166,8 +165,10 @@
if (newRow != oldRow) {
NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
+ NSInteger level = newRow + 1;
for (NSMutableDictionary *hog in hogs)
- [hog setObject:[NSNumber numberWithInt:newRow+1] forKey:@"level"];
+ [hog setObject:[NSNumber numberWithInt:level] forKey:@"level"];
+ DLog(@"New level is %d",level);
// tell our boss to write this new stuff on disk
[[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -20,7 +20,7 @@
#import "MainMenuViewController.h"
-#import "CommodityFunctions.h"
+#import "CreationChamber.h"
#import "SDL_uikitappdelegate.h"
#import "PascalImports.h"
#import "GameConfigViewController.h"
@@ -35,95 +35,81 @@
return rotationManager(interfaceOrientation);
}
-// using a different thread for audio 'cos it's slow
--(void) initAudioThread {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- // do somthing in the future
- [pool release];
-}
-
// check if some configuration files are already set; if they are present it means that the current copy must be updated
-(void) createNecessaryFiles {
- NSError *err = nil;
- NSString *directoryToCheck, *fileToCheck, *fileToUpdate;
- NSString *resDir = [[NSBundle mainBundle] resourcePath];
+ NSString *sourceFile, *destinationFile;
+ NSString *resourcesDir = [[NSBundle mainBundle] resourcePath];
DLog(@"Creating necessary files");
- // create an empty saves directory by deleting the previous one (saves are incompatible between releases)
+ // SAVES - just delete and overwrite
if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
[[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
[[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
- // if the settings file is already present, we merge current preferences with the update
- fileToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir];
+ // SETTINGS FILE - merge when present
+ NSString *baseSettingsFile = [[NSString alloc] initWithFormat:@"%@/Settings/settings.plist",resourcesDir];
if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) {
NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()];
- NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:fileToCheck];
+ NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:baseSettingsFile];
+ // the order of what adds what is important
[update addEntriesFromDictionary:settings];
[settings release];
[update writeToFile:SETTINGS_FILE() atomically:YES];
[update release];
} else
- [[NSFileManager defaultManager] copyItemAtPath:fileToCheck toPath:SETTINGS_FILE() error:&err];
-
- // TODO: scrap this and always copy the bundled files; update exisising ones in some way
- // if the teams are already present we merge the old teams, else we copy new teams
- directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Teams",resDir];
- if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()]) {
- for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:&err]) {
- fileToCheck = [NSString stringWithFormat:@"%@/%@",TEAMS_DIRECTORY(),str];
- fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Teams/%@",resDir,str];
- if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
- NSDictionary *team = [[NSDictionary alloc] initWithContentsOfFile:fileToCheck];
- NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:fileToUpdate];
- [update addEntriesFromDictionary:team];
- [team release];
- [update writeToFile:fileToCheck atomically:YES];
- [update release];
- } else
- [[NSFileManager defaultManager] copyItemAtPath:fileToUpdate toPath:fileToCheck error:&err];
+ [[NSFileManager defaultManager] copyItemAtPath:baseSettingsFile toPath:SETTINGS_FILE() error:NULL];
+ [baseSettingsFile release];
+
+ // TEAMS - update exisiting teams with new format
+ if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()] == NO) {
+ [[NSFileManager defaultManager] createDirectoryAtPath:TEAMS_DIRECTORY()
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:NULL];
+ // we copy teams only the first time because it's unlikely that newer ones are going to be added
+ NSString *baseTeamsDir = [[NSString alloc] initWithFormat:@"%@/Settings/Teams/",resourcesDir];
+ for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:baseTeamsDir error:NULL]) {
+ sourceFile = [baseTeamsDir stringByAppendingString:str];
+ destinationFile = [TEAMS_DIRECTORY() stringByAppendingString:str];
+ [[NSFileManager defaultManager] removeItemAtPath:destinationFile error:NULL];
+ [[NSFileManager defaultManager] copyItemAtPath:sourceFile toPath:destinationFile error:NULL];
}
- } else
- [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:TEAMS_DIRECTORY() error:&err];
-
- // TODO: scrap this and always copy the bundled files; update exisising ones in some way
- // the same holds for schemes (but they're dictionaries containing arrays)
- directoryToCheck = [NSString stringWithFormat:@"%@/Settings/Schemes",resDir];
- if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()]) {
- for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryToCheck error:nil]) {
- fileToCheck = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),str];
- fileToUpdate = [NSString stringWithFormat:@"%@/Settings/Schemes/%@",resDir,str];
- if ([[NSFileManager defaultManager] fileExistsAtPath:fileToCheck]) {
- NSDictionary *scheme = [[NSDictionary alloc] initWithContentsOfFile:fileToCheck];
- NSDictionary *update = [[NSDictionary alloc] initWithContentsOfFile:fileToUpdate];
- if ([[update objectForKey:@"basic"] count] > [[scheme objectForKey:@"basic"] count] ||
- [[update objectForKey:@"gamemod"] count] > [[scheme objectForKey:@"gamemod"] count])
- [update writeToFile:fileToCheck atomically:YES];
- [update release];
- [scheme release];
- } else
- [[NSFileManager defaultManager] copyItemAtPath:fileToUpdate toPath:fileToCheck error:&err];
- }
- } else
- [[NSFileManager defaultManager] copyItemAtPath:directoryToCheck toPath:SCHEMES_DIRECTORY() error:&err];
-
- // weapons are autoupdated at runtime but it's better to update then every new version
+ [baseTeamsDir release];
+ }
+ // TODO: is merge needed?
+
+ // SCHEMES - update old stuff and add new stuff
+ if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == NO)
+ [[NSFileManager defaultManager] createDirectoryAtPath:SCHEMES_DIRECTORY()
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:NULL];
+ // TODO: do the merge if necessary
+ // we overwrite the default ones because it is likely that new modes are added every release
+ NSString *baseSchemesDir = [[NSString alloc] initWithFormat:@"%@/Settings/Schemes/",resourcesDir];
+ for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:baseSchemesDir error:NULL]) {
+ sourceFile = [baseSchemesDir stringByAppendingString:str];
+ destinationFile = [SCHEMES_DIRECTORY() stringByAppendingString:str];
+ [[NSFileManager defaultManager] removeItemAtPath:destinationFile error:NULL];
+ [[NSFileManager defaultManager] copyItemAtPath:sourceFile toPath:destinationFile error:NULL];
+ }
+ [baseSchemesDir release];
+
+ // WEAPONS - always overwrite
if ([[NSFileManager defaultManager] fileExistsAtPath:WEAPONS_DIRECTORY()] == NO)
[[NSFileManager defaultManager] createDirectoryAtPath:WEAPONS_DIRECTORY()
withIntermediateDirectories:YES
attributes:nil
- error:&err];
+ error:NULL];
createWeaponNamed(@"Default", 0);
createWeaponNamed(@"Crazy", 1);
- createWeaponNamed(@"Pro mode", 2);
+ createWeaponNamed(@"Pro Mode", 2);
createWeaponNamed(@"Shoppa", 3);
- createWeaponNamed(@"Clean slate", 4);
+ createWeaponNamed(@"Clean Slate", 4);
createWeaponNamed(@"Minefield", 5);
+ createWeaponNamed(@"Thinking with Portals", 6);
- if (err != nil)
- DLog(@"%@", err);
- else
- DLog(@"Success");
+ DLog(@"Success");
}
#pragma mark -
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -72,7 +72,7 @@
// perform as if user clicked on an entry
[self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
if (IS_NOT_POWERFUL() == NO)
- [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES];
+ [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}
-(void) turnOffWidgets {
@@ -350,19 +350,6 @@
self.staticMapCommand = staticmap;
self.missionCommand = mission;
- // nice animation for updating the table when appropriate (on iphone)
- /*
- if (IS_IPAD() == NO)
- if (((oldPage == 0 || oldPage == 2) && (newPage == 1 || newPage == 3)) ||
- ((oldPage == 1 || oldPage == 3) && (newPage == 0 || newPage == 2)) ||
- ((oldPage == 1 && newPage == 3) || (oldPage == 3 || newPage == 1))) {
- self.tableView.frame = CGRectMake(480, 0, 185, 276);
- [UIView beginAnimations:@"moving in table" context:NULL];
- self.tableView.frame = CGRectMake(295, 0, 185, 276);
- [UIView commitAnimations];
- }
- */
-
[self.tableView reloadData];
[self updatePreview];
oldPage = newPage;
@@ -385,13 +372,36 @@
[string release];
// remove a trailing "" element
[themeArray removeLastObject];
- NSArray *mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
- NSArray *missionArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
+ NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
+ NSMutableArray *mapArray = [[NSMutableArray alloc] init];
+ for (NSString *str in mapArrayFull) {
+ CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
+ //DLog(@"%@ %f %f", str, imgSize.width, imgSize.height);
+ if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
+ continue;
+ if (IS_IPAD() && imgSize.height > 1280.0f)
+ continue;
+ [mapArray addObject:str];
+ }
+ NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
+ NSMutableArray *missionArray = [[NSMutableArray alloc] init];
+ for (NSString *str in missionArrayFull) {
+ CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
+ //DLog(@"%@ %f %f", str, imgSize.width, imgSize.height);
+ if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
+ continue;
+ if (IS_IPAD() && imgSize.height > 1280.0f)
+ continue;
+ [missionArray addObject:str];
+ }
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
+ [missionArray release];
+ [themeArray release];
+ [mapArray release];
+
self.dataSourceArray = array;
[array release];
- [themeArray release];
}
-(void) viewDidLoad {
@@ -469,11 +479,9 @@
-(void) didReceiveMemoryWarning {
self.dataSourceArray = nil;
- self.previewButton = nil;
self.tableView = nil;
self.maxLabel = nil;
self.sizeLabel = nil;
- self.segmentedControl = nil;
self.slider = nil;
MSG_MEMCLEAN();
--- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -20,7 +20,7 @@
#import "SchemeSettingsViewController.h"
-#import "CommodityFunctions.h"
+#import "CreationChamber.h"
#import "SingleSchemeViewController.h"
@implementation SchemeSettingsViewController
@@ -81,12 +81,14 @@
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];
- [self.tableView reloadData];
+ NSInteger index = [self.listOfSchemes indexOfObject:fileName];
+ [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
+ [fileName release];
}
#pragma mark -
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Sat Nov 13 03:26:14 2010 +0100
@@ -31,13 +31,16 @@
NSString *selectedScheme;
NSString *selectedWeapon;
+
+ UISwitch *syncSwitch;
}
-@property (nonatomic, retain) NSArray *listOfSchemes;
-@property (nonatomic, retain) NSArray *listOfWeapons;
+@property (nonatomic,retain) NSArray *listOfSchemes;
+@property (nonatomic,retain) NSArray *listOfWeapons;
@property (nonatomic,retain) NSIndexPath *lastIndexPath_sc;
@property (nonatomic,retain) NSIndexPath *lastIndexPath_we;
@property (nonatomic,retain) NSString *selectedScheme;
@property (nonatomic,retain) NSString *selectedWeapon;
+@property (nonatomic,retain) UISwitch *syncSwitch;
@end
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -24,7 +24,7 @@
#import "SDL_uikitappdelegate.h"
@implementation SchemeWeaponConfigViewController
-@synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon;
+@synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon, syncSwitch;
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
@@ -81,27 +81,30 @@
#pragma mark -
#pragma mark Table view data source
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
- return 2;
+ return 3;
}
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return [self.listOfSchemes count];
+ else if (section == 1)
+ return [self.listOfWeapons count];
else
- return [self.listOfWeapons count];
+ return 1;
}
// Customize the appearance of table view cells.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
NSInteger row = [indexPath row];
+ NSInteger section = [indexPath section];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryView = nil;
- if ([indexPath section] == 0) {
+ if (0 == section) {
cell.textLabel.text = [[self.listOfSchemes objectAtIndex:row] stringByDeletingPathExtension];
NSString *str = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
@@ -113,7 +116,7 @@
[checkbox release];
self.lastIndexPath_sc = indexPath;
}
- } else {
+ } else if (1 == section) {
cell.textLabel.text = [[self.listOfWeapons objectAtIndex:row] stringByDeletingPathExtension];
NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
@@ -125,8 +128,19 @@
[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 blackColor];
cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
cell.detailTextLabel.textColor = [UIColor whiteColor];
@@ -142,8 +156,11 @@
NSString *text;
if (section == 0)
text = NSLocalizedString(@"Schemes",@"");
+ else if (section == 1)
+ text = NSLocalizedString(@"Weapons",@"");
else
- text = NSLocalizedString(@"Weapons",@"");
+ text = NSLocalizedString(@"Options",@"");
+
UILabel *theLabel = createBlueLabel(text, frame);
theLabel.center = CGPointMake(self.view.frame.size.width/2, 20);
@@ -177,6 +194,17 @@
if ([indexPath section] == 0) {
self.lastIndexPath_sc = indexPath;
self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow];
+ if (self.syncSwitch.on) {
+ for (NSString *str in self.listOfWeapons) {
+ if ([str isEqualToString:self.selectedScheme]) {
+ int index = [self.listOfSchemes indexOfObject:str];
+ self.selectedWeapon = str;
+ self.lastIndexPath_we = [NSIndexPath indexPathForRow:index inSection:1];
+ [self.tableView reloadData];
+ break;
+ }
+ }
+ }
} else {
self.lastIndexPath_we = indexPath;
self.selectedWeapon = [self.listOfWeapons objectAtIndex:newRow];
@@ -195,6 +223,7 @@
self.lastIndexPath_we = nil;
self.listOfSchemes = nil;
self.listOfWeapons = nil;
+ self.syncSwitch = nil;
MSG_MEMCLEAN();
}
[super didReceiveMemoryWarning];
@@ -207,6 +236,7 @@
self.lastIndexPath_we = nil;
self.selectedScheme = nil;
self.selectedWeapon = nil;
+ self.syncSwitch = nil;
MSG_DIDUNLOAD();
[super viewDidUnload];
}
@@ -219,6 +249,7 @@
[lastIndexPath_we release];
[selectedScheme release];
[selectedWeapon release];
+ [syncSwitch release];
[super dealloc];
}
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -153,6 +153,7 @@
if (row == 0) {
editableCell.textField.text = self.schemeName;
+ editableCell.textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
} else {
editableCell.minimumCharacters = 0;
editableCell.textField.font = [UIFont systemFontOfSize:[UIFont labelFontSize]];
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -150,6 +150,7 @@
if (row == 0) {
editableCell.textField.text = self.weaponName;
+ editableCell.textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
} else {
editableCell.minimumCharacters = 0;
editableCell.textField.font = [UIFont systemFontOfSize:[UIFont labelFontSize]];
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -125,7 +125,12 @@
[cell addSubview:squareButton];
[squareButton release];
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+6+36, 10, 103, 25)];
+ NSInteger length;
+ if (IS_IPAD())
+ length = 103;
+ else
+ length = 285;
+ UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(12+88+6+36, 10, length, 25)];
label.textAlignment = UITextAlignmentLeft;
label.minimumFontSize = 11;
label.adjustsFontSizeToFitWidth = YES;
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -20,8 +20,8 @@
#import "TeamSettingsViewController.h"
+#import "CreationChamber.h"
#import "SingleTeamViewController.h"
-#import "CommodityFunctions.h"
@implementation TeamSettingsViewController
@synthesize listOfTeams;
@@ -85,12 +85,14 @@
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];
- [self.tableView reloadData];
+ NSInteger index = [self.listOfTeams indexOfObject:fileName];
+ [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
+ [fileName release];
}
#pragma mark -
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Sat Nov 13 03:26:14 2010 +0100
@@ -20,7 +20,7 @@
#import "WeaponSettingsViewController.h"
-#import "CommodityFunctions.h"
+#import "CreationChamber.h"
#import "SingleWeaponViewController.h"
@implementation WeaponSettingsViewController
@@ -82,12 +82,14 @@
createWeaponNamed([fileName stringByDeletingPathExtension], 0);
[self.listOfWeapons addObject:fileName];
- [fileName release];
// order the array alphabetically, so schemes will keep their position
[self.listOfWeapons sortUsingSelector:@selector(compare:)];
+ [self.tableView reloadData];
- [self.tableView reloadData];
+ NSInteger index = [self.listOfWeapons indexOfObject:fileName];
+ [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
+ [fileName release];
}
#pragma mark -
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sat Nov 13 03:26:14 2010 +0100
@@ -25,6 +25,7 @@
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 */; settings = {ATTRIBUTES = (Required, ); }; };
+ 61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */ = {isa = PBXBuildFile; fileRef = 61006F94128DE31F00EBA7F7 /* CreationChamber.m */; };
610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; };
610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; };
611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; };
@@ -730,6 +731,8 @@
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 = "<group>"; };
+ 61006F93128DE31F00EBA7F7 /* CreationChamber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CreationChamber.h; path = Classes/CreationChamber.h; sourceTree = "<group>"; };
+ 61006F94128DE31F00EBA7F7 /* CreationChamber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CreationChamber.m; path = Classes/CreationChamber.m; sourceTree = "<group>"; };
611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = "<group>"; };
611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = "<group>"; };
611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SavedGamesViewController.xib; path = ../Resources/SavedGamesViewController.xib; sourceTree = "<group>"; };
@@ -1023,6 +1026,8 @@
6165922D11CA9BD500D6E256 /* UIImageExtra.m */,
61D2059F127CDD1100ABD83E /* ObjcExports.h */,
61D205A0127CDD1100ABD83E /* ObjcExports.m */,
+ 61006F93128DE31F00EBA7F7 /* CreationChamber.h */,
+ 61006F94128DE31F00EBA7F7 /* CreationChamber.m */,
);
name = "Other Sources";
sourceTree = "<group>";
@@ -2284,6 +2289,7 @@
61DE8F221257EB1100B80214 /* AmmoMenuViewController.m in Sources */,
61399013125D19C0003C2DC0 /* uMobile.pas in Sources */,
61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */,
+ 61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Clean Slate.plist Sat Nov 13 03:26:14 2010 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>basic</key>
+ <array>
+ <integer>100</integer>
+ <integer>45</integer>
+ <integer>100</integer>
+ <integer>15</integer>
+ <integer>47</integer>
+ <integer>5</integer>
+ <integer>5</integer>
+ <integer>35</integer>
+ <integer>25</integer>
+ <integer>3</integer>
+ <integer>4</integer>
+ <integer>0</integer>
+ <integer>2</integer>
+ </array>
+ <key>gamemod</key>
+ <array>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <true/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <true/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <true/>
+ <true/>
+ <false/>
+ <false/>
+ </array>
+</dict>
+</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Fort Mode.plist Sat Nov 13 03:26:14 2010 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>basic</key>
+ <array>
+ <integer>100</integer>
+ <integer>45</integer>
+ <integer>100</integer>
+ <integer>15</integer>
+ <integer>47</integer>
+ <integer>5</integer>
+ <integer>5</integer>
+ <integer>35</integer>
+ <integer>25</integer>
+ <integer>3</integer>
+ <integer>0</integer>
+ <integer>0</integer>
+ <integer>0</integer>
+ </array>
+ <key>gamemod</key>
+ <array>
+ <false/>
+ <false/>
+ <true/>
+ <true/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <true/>
+ <true/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ </array>
+</dict>
+</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Thinking with Portals.plist Sat Nov 13 03:26:14 2010 +0100
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>basic</key>
+ <array>
+ <integer>100</integer>
+ <integer>45</integer>
+ <integer>100</integer>
+ <integer>15</integer>
+ <integer>47</integer>
+ <integer>5</integer>
+ <integer>2</integer>
+ <integer>25</integer>
+ <integer>25</integer>
+ <integer>4</integer>
+ <integer>5</integer>
+ <integer>0</integer>
+ <integer>5</integer>
+ </array>
+ <key>gamemod</key>
+ <array>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <true/>
+ <true/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ <false/>
+ </array>
+</dict>
+</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<true/>
+ <false/>
</array>
</dict>
</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist Sat Nov 13 03:26:14 2010 +0100
@@ -41,6 +41,7 @@
<false/>
<false/>
<false/>
+ <false/>
</array>
</dict>
</plist>
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Fri Nov 12 18:57:36 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Sat Nov 13 03:26:14 2010 +0100
@@ -170,5 +170,13 @@
<key>title</key>
<string>Per Hedgehog Ammo</string>
</dict>
+ <dict>
+ <key>description</key>
+ <string>Wind will not affect weapons</string>
+ <key>image</key>
+ <string>NoWind</string>
+ <key>title</key>
+ <string>Disable Wind</string>
+ </dict>
</array>
</plist>