summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorSimon Howard2011-02-24 20:57:30 +0000
committerSimon Howard2011-02-24 20:57:30 +0000
commit72c1191348ab26e7d3171791c48353cd708a74fa (patch)
tree3d500af7e12929ac5a74f06df7a544c1b7bbb43e /pkg
parentb24a72cfd68ccf06ab86a70356f5c6df87bd9eb6 (diff)
downloadchocolate-doom-72c1191348ab26e7d3171791c48353cd708a74fa.tar.gz
chocolate-doom-72c1191348ab26e7d3171791c48353cd708a74fa.tar.bz2
chocolate-doom-72c1191348ab26e7d3171791c48353cd708a74fa.zip
Make code changes to add Heretic/Hexen support to OS X launcher.
Subversion-branch: /branches/raven-branch Subversion-revision: 2277
Diffstat (limited to 'pkg')
-rw-r--r--pkg/osx/IWADController.h4
-rw-r--r--pkg/osx/IWADController.m35
-rw-r--r--pkg/osx/LauncherManager.m24
3 files changed, 59 insertions, 4 deletions
diff --git a/pkg/osx/IWADController.h b/pkg/osx/IWADController.h
index 90f44667..fef28918 100644
--- 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
diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m
index 3c596850..6cab7ff2 100644
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -33,6 +33,8 @@ typedef enum
IWAD_TNT,
IWAD_PLUTONIA,
IWAD_CHEX,
+ IWAD_HERETIC,
+ IWAD_HEXEN,
NUM_IWAD_TYPES
} IWAD;
@@ -42,7 +44,9 @@ static NSString *IWADLabels[NUM_IWAD_TYPES] =
@"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 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
@"tnt.wad",
@"plutonia.wad",
@"chex.wad",
+ @"heretic.wad",
+ @"hexen.wad",
@"undefined"
};
@@ -64,6 +70,8 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
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 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
}
}
+// 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 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
- (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.
diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m
index 8c523ab4..36723db5 100644
--- a/pkg/osx/LauncherManager.m
+++ b/pkg/osx/LauncherManager.m
@@ -278,6 +278,8 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
{
NSString *iwad;
NSString *args;
+ char *executable_name;
+ const char *game_name;
[self saveConfig];
@@ -294,7 +296,11 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
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 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
- (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