author | koda |
Tue, 04 Jan 2011 01:21:30 +0100 | |
changeset 4811 | 3edc0cdcfe03 |
parent 4607 | 7f683c2357a0 |
child 4945 | 541d35d1f2e8 |
permissions | -rw-r--r-- |
4281 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
3 |
* Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 12/11/2010. |
|
19 |
*/ |
|
20 |
||
21 |
||
22 |
#import "CreationChamber.h" |
|
23 |
||
24 |
void createTeamNamed (NSString *nameWithoutExt) { |
|
25 |
NSString *teamsDirectory = TEAMS_DIRECTORY(); |
|
26 |
||
27 |
if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { |
|
28 |
[[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory |
|
29 |
withIntermediateDirectories:NO |
|
30 |
attributes:nil |
|
31 |
error:NULL]; |
|
32 |
} |
|
33 |
||
34 |
NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: HW_getMaxNumberOfHogs()]; |
|
35 |
||
36 |
for (int i = 0; i < HW_getMaxNumberOfHogs(); i++) { |
|
37 |
NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; |
|
38 |
NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
39 |
[NSNumber numberWithInt:0],@"level", |
|
40 |
hogName,@"hogname", |
|
41 |
@"NoHat",@"hat", |
|
42 |
nil]; |
|
43 |
[hogName release]; |
|
44 |
[hedgehogs addObject:hog]; |
|
45 |
[hog release]; |
|
46 |
} |
|
47 |
||
48 |
NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
49 |
@"0",@"hash", |
|
50 |
@"Statue",@"grave", |
|
51 |
@"Plane",@"fort", |
|
52 |
@"Default",@"voicepack", |
|
53 |
@"hedgewars",@"flag", |
|
54 |
hedgehogs,@"hedgehogs", |
|
55 |
nil]; |
|
56 |
[hedgehogs release]; |
|
57 |
||
58 |
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt]; |
|
59 |
||
60 |
[theTeam writeToFile:teamFile atomically:YES]; |
|
61 |
[teamFile release]; |
|
62 |
[theTeam release]; |
|
63 |
} |
|
64 |
||
65 |
void createWeaponNamed (NSString *nameWithoutExt, int type) { |
|
66 |
NSString *weaponsDirectory = WEAPONS_DIRECTORY(); |
|
67 |
||
68 |
if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) { |
|
69 |
[[NSFileManager defaultManager] createDirectoryAtPath:weaponsDirectory |
|
70 |
withIntermediateDirectories:NO |
|
71 |
attributes:nil |
|
72 |
error:NULL]; |
|
73 |
} |
|
74 |
||
75 |
NSDictionary *theWeapon = nil; |
|
76 |
switch (type) { |
|
4607 | 77 |
default: //default |
4281 | 78 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
4607 | 79 |
@"939192942219912103223511100120100000021111010101112",@"ammostore_initialqt", |
80 |
@"040504054160065554655446477657666666615551010111541",@"ammostore_probability", |
|
81 |
@"000000000000020550000004000700400000000020000000060",@"ammostore_delay", |
|
82 |
@"131111031211111112311411111111111111121111110111112",@"ammostore_crate", nil]; |
|
4281 | 83 |
break; |
84 |
case 1: //crazy |
|
85 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4607 | 86 |
@"999999999999999999299999999999999929999999990999999",@"ammostore_initialqt", |
87 |
@"111111011111111111111111111111111111111111110111111",@"ammostore_probability", |
|
88 |
@"000000000000000000000000000000000000000000000000000",@"ammostore_delay", |
|
89 |
@"131111031211111112311411111111111111121111010111111",@"ammostore_crate", nil]; |
|
4281 | 90 |
break; |
91 |
case 2: //pro mode |
|
92 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4607 | 93 |
@"909000900000000000000900000000000000000000000000000",@"ammostore_initialqt", |
94 |
@"000000000000000000000000000000000000000000000000000",@"ammostore_probability", |
|
95 |
@"000000000000020550000004000700400000000020000000000",@"ammostore_delay", |
|
96 |
@"111111111111111111111111111111111111111110010111111",@"ammostore_crate", nil]; |
|
4281 | 97 |
break; |
98 |
case 3: //shoppa |
|
99 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4607 | 100 |
@"000000990000000000000000000000000000000000000000000",@"ammostore_initialqt", |
101 |
@"444441004424440221011212122242200000000200040001001",@"ammostore_probability", |
|
102 |
@"000000000000000000000000000000000000000000000000000",@"ammostore_delay", |
|
103 |
@"111111111111111111111111111111111111111110110111111",@"ammostore_crate", nil]; |
|
4281 | 104 |
break; |
105 |
case 4: //clean slate |
|
106 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4607 | 107 |
@"101000900001000001100000000000000000000000000000100",@"ammostore_initialqt", |
108 |
@"040504054160065554655446477657666666615551010111541",@"ammostore_probability", |
|
109 |
@"000000000000020550000004000700400000000020000000000",@"ammostore_delay", |
|
110 |
@"131111031211111112311411111111111111121111110111111",@"ammostore_crate", nil]; |
|
4281 | 111 |
break; |
112 |
case 5: //minefield |
|
113 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
|
4607 | 114 |
@"000000990009000000030000000000000000000000000000000",@"ammostore_initialqt", |
115 |
@"000000000000000000000000000000000000000000000000000",@"ammostore_probability", |
|
116 |
@"000000000000020550000004000700400000000020000000000",@"ammostore_delay", |
|
117 |
@"111111111111111111111111111111111111111111110111111",@"ammostore_crate", nil]; |
|
4284
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
118 |
break; |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
119 |
case 6: //thinking with portals |
57a501a69e5f
update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents:
4281
diff
changeset
|
120 |
theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: |
4607 | 121 |
@"900000900200000000210000000000000011000009000000000",@"ammostore_initialqt", |
122 |
@"040504054160065554655446477657666666615551010111541",@"ammostore_probability", |
|
123 |
@"000000000000020550000004000700400000000020000000060",@"ammostore_delay", |
|
124 |
@"131111031211111112311411111111111111121111110111111",@"ammostore_crate", nil]; |
|
4281 | 125 |
break; |
126 |
} |
|
127 |
||
128 |
NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt]; |
|
129 |
||
130 |
[theWeapon writeToFile:weaponFile atomically:YES]; |
|
131 |
[weaponFile release]; |
|
132 |
[theWeapon release]; |
|
133 |
} |
|
134 |
||
135 |
void createSchemeNamed (NSString *nameWithoutExt) { |
|
136 |
NSString *schemesDirectory = SCHEMES_DIRECTORY(); |
|
137 |
||
138 |
if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { |
|
139 |
[[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory |
|
140 |
withIntermediateDirectories:NO |
|
141 |
attributes:nil |
|
142 |
error:NULL]; |
|
143 |
} |
|
144 |
||
4607 | 145 |
int basicFlags[] = {100, 100, 45, 15, 47, 5, 100, 5, 35, 25, 3, 4, 0, 2}; |
146 |
BOOL gameFlags[] = {NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, YES, NO, NO, NO, NO, |
|
147 |
NO, NO, NO, NO, NO, NO, NO}; |
|
148 |
||
4281 | 149 |
NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects: |
4607 | 150 |
[NSNumber numberWithInt:basicFlags[0]], //initialhealth |
151 |
[NSNumber numberWithInt:basicFlags[1]], //damagemodifier |
|
152 |
[NSNumber numberWithInt:basicFlags[2]], //turntime |
|
153 |
[NSNumber numberWithInt:basicFlags[3]], //suddendeathtimeout |
|
154 |
[NSNumber numberWithInt:basicFlags[4]], //waterrise |
|
155 |
[NSNumber numberWithInt:basicFlags[5]], //healthdecrease |
|
156 |
[NSNumber numberWithInt:basicFlags[6]], //ropelength |
|
157 |
[NSNumber numberWithInt:basicFlags[7]], //cratedrops |
|
158 |
[NSNumber numberWithInt:basicFlags[8]], //healthprob |
|
159 |
[NSNumber numberWithInt:basicFlags[9]], //healthamount |
|
160 |
[NSNumber numberWithInt:basicFlags[10]], //minestime |
|
161 |
[NSNumber numberWithInt:basicFlags[11]], //minesnumber |
|
162 |
[NSNumber numberWithInt:basicFlags[12]], //dudmines |
|
163 |
[NSNumber numberWithInt:basicFlags[13]], //explosives |
|
4281 | 164 |
nil]; |
165 |
||
166 |
NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithObjects: |
|
4607 | 167 |
[NSNumber numberWithBool:gameFlags[0]], //fortmode |
168 |
[NSNumber numberWithBool:gameFlags[1]], //divideteam |
|
169 |
[NSNumber numberWithBool:gameFlags[2]], //solidland |
|
170 |
[NSNumber numberWithBool:gameFlags[3]], //addborder |
|
171 |
[NSNumber numberWithBool:gameFlags[4]], //lowgravity |
|
172 |
[NSNumber numberWithBool:gameFlags[5]], //lasersight |
|
173 |
[NSNumber numberWithBool:gameFlags[6]], //invulnerable |
|
174 |
[NSNumber numberWithBool:gameFlags[7]], //resethealth |
|
175 |
[NSNumber numberWithBool:gameFlags[8]], //vampirism |
|
176 |
[NSNumber numberWithBool:gameFlags[9]], //karma |
|
177 |
[NSNumber numberWithBool:gameFlags[10]], //artillery |
|
178 |
[NSNumber numberWithBool:gameFlags[11]], //randomorder |
|
179 |
[NSNumber numberWithBool:gameFlags[12]], //king |
|
180 |
[NSNumber numberWithBool:gameFlags[13]], //placehedgehogs |
|
181 |
[NSNumber numberWithBool:gameFlags[14]], //clansharesammo |
|
182 |
[NSNumber numberWithBool:gameFlags[15]], //disablegirders |
|
183 |
[NSNumber numberWithBool:gameFlags[16]], //disablelandobjects |
|
184 |
[NSNumber numberWithBool:gameFlags[17]], //aisurvival |
|
185 |
[NSNumber numberWithBool:gameFlags[18]], //infattack |
|
186 |
[NSNumber numberWithBool:gameFlags[19]], //resetweaps |
|
187 |
[NSNumber numberWithBool:gameFlags[20]], //perhogammo |
|
188 |
[NSNumber numberWithBool:gameFlags[21]], //nowind |
|
189 |
[NSNumber numberWithBool:gameFlags[22]], //morewind |
|
4281 | 190 |
nil]; |
191 |
||
192 |
NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: |
|
193 |
basicArray,@"basic", |
|
194 |
gamemodArray,@"gamemod", |
|
195 |
nil]; |
|
196 |
[gamemodArray release]; |
|
197 |
[basicArray release]; |
|
198 |
||
199 |
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; |
|
200 |
||
201 |
[theScheme writeToFile:schemeFile atomically:YES]; |
|
202 |
[schemeFile release]; |
|
203 |
[theScheme release]; |
|
204 |
} |