98 |
98 |
99 if ('C' == buffer[0]) { |
99 if ('C' == buffer[0]) { |
100 NSLog(@"engineProtocol - sending game config"); |
100 NSLog(@"engineProtocol - sending game config"); |
101 |
101 |
102 // send config data data |
102 // send config data data |
103 |
103 /*seed is arbitrary string |
104 // local game |
104 [16:12] unC0Rr: |
|
105 addteam <color> <team name> |
|
106 [16:13] unC0Rr: |
|
107 addhh <level> <health> <hedgehog name> |
|
108 [16:13] unC0Rr: |
|
109 <level> is 0 for human, 1-5 for bots (5 is the most stupid)*/ // local game |
105 [self sendToEngine:@"TL"]; |
110 [self sendToEngine:@"TL"]; |
106 |
111 |
107 // seed info |
112 // seed info |
108 [self sendToEngine:@"eseed {232c1b42-7d39-4ee6-adf8-4240e1f1efb8}"]; |
113 [self sendToEngine:@"eseed {232c1b42-7d39-4ee6-adf8-4240e1f1efb8}"]; |
109 |
114 |
246 } |
251 } |
247 |
252 |
248 #pragma mark - |
253 #pragma mark - |
249 #pragma mark Settings setup methods |
254 #pragma mark Settings setup methods |
250 -(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName { |
255 -(void) loadSettingsFromFile:(NSString *)fileName forKey:(NSString *)objName { |
251 NSString *filePath = [SDLUIKitDelegate dataFilePath:fileName]; |
256 NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:fileName]; |
252 |
257 |
253 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { |
258 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { |
254 NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath]; |
259 NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:filePath]; |
255 [self setValue:dict forKey:objName]; |
260 [self setValue:dict forKey:objName]; |
256 [dict release]; |
261 [dict release]; |
260 } |
265 } |
261 |
266 |
262 } |
267 } |
263 |
268 |
264 -(void) unloadSettings { |
269 -(void) unloadSettings { |
265 [systemSettings dealloc]; |
270 [systemSettings release]; |
266 } |
271 } |
267 |
|
268 -(void) setArgsForLocalPlay { |
|
269 NSString *portNumber = [[NSString alloc] initWithFormat:@"%d", ipcPort]; |
|
270 //NSString *username = [[NSString alloc] initWithString:[systemSettings objectForKey:@"username"]]; |
|
271 /*for (NSString *theString in [NSLocale ISOLanguageCodes]) { |
|
272 NSLog(theString); |
|
273 }*/ |
|
274 |
|
275 memset(forward_argv, 0, forward_argc); |
|
276 |
|
277 forward_argc = 18; |
|
278 forward_argv = (char **)realloc(forward_argv, forward_argc * sizeof(char *)); |
|
279 //forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char)); |
|
280 forward_argv[ 1] = forward_argv[0]; // (UNUSED) |
|
281 forward_argv[ 2] = "320"; // cScreenWidth |
|
282 forward_argv[ 3] = "480"; // cScreenHeight |
|
283 forward_argv[ 4] = "16"; // cBitsStr |
|
284 forward_argv[ 5] = [portNumber UTF8String]; // ipcPort; |
|
285 forward_argv[ 6] = "1"; // cFullScreen (NO EFFECT) |
|
286 forward_argv[ 7] = [[systemSettings objectForKey:@"effects"] UTF8String]; // isSoundEnabled |
|
287 forward_argv[ 8] = "1"; // cVSyncInUse (UNUSED) |
|
288 forward_argv[ 9] = [localeString UTF8String]; // cLocaleFName |
|
289 forward_argv[10] = [[systemSettings objectForKey:@"volume"] UTF8String]; // cInitVolume |
|
290 forward_argv[11] = "8"; // cTimerInterval |
|
291 forward_argv[12] = "Data"; // PathPrefix |
|
292 forward_argv[13] = "1"; // cShowFPS (TOSET?) |
|
293 forward_argv[14] = [[systemSettings objectForKey:@"alternate"] UTF8String]; // cAltDamage (TOSET) |
|
294 forward_argv[15] = "Koda"; // UserNick (DecodeBase64(ParamStr(15)) FTW) <- TODO |
|
295 forward_argv[16] = [[systemSettings objectForKey:@"music"] UTF8String]; // isMusicEnabled |
|
296 forward_argv[17] = "0"; // cReducedQuality |
|
297 |
|
298 [portNumber release]; |
|
299 return; |
|
300 } |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
272 |
306 |
273 |
307 @end |
274 @end |