View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002622 | FSSCP | gameplay | public | 2012-03-04 12:05 | 2012-03-06 13:11 |
Reporter | karajorma | Assigned To | karajorma | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Fixed in Version | 3.6.14 | ||||
Summary | 0002622: Select Default Campaign Via Mod.tbl | ||||
Description | Adds a setting to game_settings.tbl that allows you to specify which campaign should be set for new pilots. Very useful from mods based on FS2 (which otherwise will start with the main Freespace2 Campaign selected). I'll probably later add a feature allowing you to remove certain campaigns (if they exist) from the list. | ||||
Steps To Reproduce | 1) Create a game_settings.tbl with the appropriate setting #CAMPAIGN SETTINGS ;; Sets default campaign file the game will look for with new pilots $Default Campaign File Name: <CampaignName> 2) Run the game and create a new pilot. | ||||
Tags | No tags attached. | ||||
|
Default_Campaign.patch (4,566 bytes)
Index: code/fred2/campaigneditordlg.cpp =================================================================== --- code/fred2/campaigneditordlg.cpp (revision 8557) +++ code/fred2/campaigneditordlg.cpp (working copy) @@ -180,7 +180,7 @@ load_tree(0); if (!strlen(Campaign.filename)) - strcpy_s(Campaign.filename, BUILTIN_CAMPAIGN); + strcpy_s(Campaign.filename, Default_campaign_file_name); if (mission_campaign_load(Campaign.filename, NULL, 0)) { MessageBox("Couldn't open Campaign file!", "Error"); Index: code/globalincs/def_files.cpp =================================================================== --- code/globalincs/def_files.cpp (revision 8557) +++ code/globalincs/def_files.cpp (working copy) @@ -104,6 +104,11 @@ ;; Mod.tbl should be used for settings which affect the entire mod and \n\ ;; only very rarely need to be changed (if ever). \n\ \n\ +#CAMPAIGN SETTINGS \n\ + \n\ +;; Sets default campaign file the game will look for with new pilots \n\ +$Default Campaign File Name: FreeSpace2 \n\ + \n\ #HUD SETTINGS \n\ \n\ ;; Sets the delay before a directive will appear on the screen (ms) \n\ Index: code/mission/missioncampaign.cpp =================================================================== --- code/mission/missioncampaign.cpp (revision 8557) +++ code/mission/missioncampaign.cpp (working copy) @@ -64,6 +64,8 @@ int Campaign_file_missing; int Campaign_names_inited = 0; +char Default_campaign_file_name[MAX_FILENAME_LEN - 4] = { NULL }; + // stuff used for campaign list building static bool MC_desc = false; static bool MC_multiplayer = false; @@ -2345,7 +2347,7 @@ if ( strlen(pl->current_campaign) ) { return mission_campaign_load(pl->current_campaign, pl); } else { - int rc = mission_campaign_load(BUILTIN_CAMPAIGN, pl); + int rc = mission_campaign_load(Default_campaign_file_name, pl); // if the builtin campaign is missing/corrupt then try and fall back on whatever is available if (rc) { Index: code/mission/missioncampaign.h =================================================================== --- code/mission/missioncampaign.h (revision 8557) +++ code/mission/missioncampaign.h (working copy) @@ -18,7 +18,6 @@ // name of the builtin campaign. #define BUILTIN_CAMPAIGN "FreeSpace2" -#define BUILTIN_CAMPAIGN_NAME "The Main FreeSpace2 Campaign" #define MAX_CAMPAIGN_MISSIONS 100 // maximum number of missions in a campaign @@ -31,7 +30,7 @@ // missions. #define CAMPAIGN_TYPE_SINGLE 0 #define CAMPAIGN_TYPE_MULTI_COOP 1 -#define CAMPAIGN_TYPE_MULTI_TEAMS 2 +#define CAMPAIGN_TYPE_MULTI_TEAMS 2 #define MAX_CAMPAIGN_TYPES 3 @@ -145,6 +144,8 @@ extern int Num_campaigns; extern int Campaign_names_inited; +extern char Default_campaign_file_name[MAX_FILENAME_LEN - 4]; + // if the campaign file is missing this will get set for us to check against extern int Campaign_file_missing; Index: code/mod_table/mod_table.cpp =================================================================== --- code/mod_table/mod_table.cpp (revision 8557) +++ code/mod_table/mod_table.cpp (working copy) @@ -6,6 +6,7 @@ #include "globalincs/pstypes.h" #include "globalincs/def_files.h" +#include "mission/missioncampaign.h" #include "mod_table/mod_table.h" #include "localization/localize.h" #include "parse/parselo.h" @@ -36,16 +37,22 @@ reset_parse(); // start parsing - required_string("#HUD SETTINGS"); - + optional_string("#CAMPAIGN SETTINGS"); + if (optional_string("$Default Campaign File Name:")) { + stuff_string(Default_campaign_file_name, F_NAME, (MAX_FILENAME_LEN - 4) ); + } + else if (Default_campaign_file_name == NULL) { + strcpy(Default_campaign_file_name, BUILTIN_CAMPAIGN); + } + + optional_string("#HUD SETTINGS"); // how long should the game wait before displaying a directive? if (optional_string("$Directive Wait Time:")) { stuff_int(&Directive_wait_time); } - required_string("#SEXP SETTINGS"); - - if (optional_string("$Loop SEXPs Then Arguments:")) { + optional_string("#SEXP SETTINGS"); + if (optional_string("$Loop SEXPs Then Arguments:")) { stuff_boolean(&True_loop_argument_sexps); if (True_loop_argument_sexps){ mprintf(("Game Settings Table : Using Reversed Loops For SEXP Arguments")); @@ -54,10 +61,7 @@ mprintf(("Game Settings Table : Using Standard Loops For SEXP Arguments")); } } - else - - required_string("#END"); // close localization |
|
Suggested change karajorma: strcpy(Default_campaign_file_name, BUILTIN_CAMPAIGN); to: strcpy_s(Default_campaign_file_name, BUILTIN_CAMPAIGN); |
|
Fixed in trunk r8586 |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-03-04 12:05 | karajorma | New Issue | |
2012-03-04 12:05 | karajorma | Status | new => assigned |
2012-03-04 12:05 | karajorma | Assigned To | => karajorma |
2012-03-04 12:05 | karajorma | File Added: Default_Campaign.patch | |
2012-03-04 12:05 | karajorma | Status | assigned => code review |
2012-03-04 12:47 | Echelon9 | Note Added: 0013380 | |
2012-03-06 13:11 | Echelon9 | Note Added: 0013400 | |
2012-03-06 13:11 | Echelon9 | Status | code review => resolved |
2012-03-06 13:11 | Echelon9 | Fixed in Version | => 3.6.14 |
2012-03-06 13:11 | Echelon9 | Resolution | open => fixed |