ref: 72c1191348ab26e7d3171791c48353cd708a74fa
parent: b24a72cfd68ccf06ab86a70356f5c6df87bd9eb6
author: Simon Howard <[email protected]>
date: Thu Feb 24 15:57:30 EST 2011
Make code changes to add Heretic/Hexen support to OS X launcher. Subversion-branch: /branches/raven-branch Subversion-revision: 2277
--- a/pkg/osx/IWADController.h
+++ b/pkg/osx/IWADController.h
@@ -36,6 +36,9 @@
id doom2;
id plutonia;
id tnt;
+
+ id heretic;
+ id hexen;
}
- (void) closeConfigWindow: (id)sender;
@@ -47,6 +50,7 @@
- (void) saveConfig;
- (char *) doomWadPath;
- (void) setEnvironment;
+- (const char *) getGameName;
@end
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -33,6 +33,8 @@
IWAD_TNT,
IWAD_PLUTONIA,
IWAD_CHEX,
+ IWAD_HERETIC,
+ IWAD_HEXEN,
NUM_IWAD_TYPES
} IWAD;
@@ -42,7 +44,9 @@
@"Doom II: Hell on Earth",
@"Final Doom: TNT: Evilution",
@"Final Doom: Plutonia Experiment",
- @"Chex Quest"
+ @"Chex Quest",
+ @"Heretic",
+ @"Hexen"
};
static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
@@ -52,6 +56,8 @@
@"tnt.wad",
@"plutonia.wad",
@"chex.wad",
+ @"heretic.wad",
+ @"hexen.wad",
@"undefined"
};
@@ -64,6 +70,8 @@
iwadList[IWAD_TNT] = self->tnt;
iwadList[IWAD_PLUTONIA] = self->plutonia;
iwadList[IWAD_CHEX] = self->chex;
+ iwadList[IWAD_HERETIC] = self->heretic;
+ iwadList[IWAD_HEXEN] = self->hexen;
}
- (IWAD) getSelectedIWAD
@@ -102,6 +110,27 @@
}
}
+// Get the name used for the executable for the selected IWAD.
+
+- (const char *) getGameName
+{
+ IWAD selectedIWAD;
+
+ selectedIWAD = [self getSelectedIWAD];
+
+ switch (selectedIWAD)
+ {
+ case IWAD_HERETIC:
+ return "heretic";
+
+ case IWAD_HEXEN:
+ return "hexen";
+
+ default:
+ return "doom";
+ }
+}
+
- (void) setIWADConfig
{
IWADLocation *iwadList[NUM_IWAD_TYPES];
@@ -250,6 +279,10 @@
- (void) awakeFromNib
{
+ // TODO: This is temporary:
+ self->heretic = self->doom1;
+ self->hexen = self->doom2;
+
[self->configWindow center];
// Set configuration for all IWADs from configuration file.
--- a/pkg/osx/LauncherManager.m
+++ b/pkg/osx/LauncherManager.m
@@ -278,6 +278,8 @@
{
NSString *iwad;
NSString *args;
+ char *executable_name;
+ const char *game_name;
[self saveConfig];
@@ -294,7 +296,11 @@
return;
}
- ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String],
+ game_name = [self->iwadController getGameName];
+ executable_name = malloc(strlen(PROGRAM_PREFIX) + strlen(game_name) + 1);
+ sprintf(executable_name, "%s%s", PROGRAM_PREFIX, game_name);
+
+ ExecuteProgram(executable_name, [iwad UTF8String],
[args UTF8String]);
[NSApp terminate:sender];
}
@@ -303,10 +309,22 @@
- (void) runSetup: (id)sender
{
- [self saveConfig];
+ const char *game_name;
+ char *arg;
+ [self saveConfig];
[self->iwadController setEnvironment];
- ExecuteProgram("chocolate-setup", NULL, NULL);
+
+ // Provide the -game command line parameter to select the game
+ // to configure, based on the game selected in the dropdown.
+
+ game_name = [self->iwadController getGameName];
+ arg = malloc(strlen(game_name) + 8);
+ sprintf(arg, "-game %s", game_name);
+
+ ExecuteProgram(PROGRAM_PREFIX "setup", NULL, arg);
+
+ free(arg);
}
// Invoked when the "Terminal" option is selected from the menu, to open