From 56a399f8daf61d519294f86a6f681d611d0d99e2 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Fri, 21 Oct 2016 09:21:31 -0400 Subject: [PATCH] use proper FS2 demo pilot files - set controls, hud gauges, ship types to match original demo - correct format and versioning of PLR and CSG files --- include/controlsconfig.h | 4 +++ include/hudgauges.h | 6 ++++ include/ship.h | 4 ++- src/controlconfig/controlsconfigcommon.cpp | 2 ++ src/hud/hud.cpp | 20 +++++++++++++ src/hud/hudconfig.cpp | 8 +++++ src/io/keycontrol.cpp | 6 ++++ src/menuui/playermenu.cpp | 1 - src/mission/missioncampaign.cpp | 29 ++++++++++-------- src/parse/sexp.cpp | 2 ++ src/playerman/managepilot.cpp | 34 ++++++++++++++-------- 11 files changed, 90 insertions(+), 26 deletions(-) diff --git a/include/controlsconfig.h b/include/controlsconfig.h index b65b0de..2f0ac17 100644 --- a/include/controlsconfig.h +++ b/include/controlsconfig.h @@ -444,6 +444,7 @@ typedef struct config_item { #ifndef MAKE_FS1 #define TOGGLE_HUD_CONTRAST 104 +#ifndef FS2_DEMO #define MULTI_TOGGLE_NETINFO 105 #define MULTI_SELF_DESTRUCT 106 @@ -451,6 +452,9 @@ typedef struct config_item { // this should be the total number of control action defines above (or last define + 1) #define CCFG_MAX 107 #else +#define CCFG_MAX 105 +#endif +#else // this should be the total number of control action defines above (or last define + 1) #define CCFG_MAX 104 #endif diff --git a/include/hudgauges.h b/include/hudgauges.h index bdbdbb4..7fd8dee 100644 --- a/include/hudgauges.h +++ b/include/hudgauges.h @@ -82,7 +82,11 @@ #define __HUD_COMMON_H__ // HUD gauge types +#ifdef FS2_DEMO +#define NUM_HUD_GAUGES 37 +#else #define NUM_HUD_GAUGES 39 +#endif #define HUD_LEAD_INDICATOR 0 #define HUD_ORIENTATION_TEE 1 @@ -121,8 +125,10 @@ #define HUD_ATTACKING_TARGET_COUNT 34 #define HUD_TEXT_FLASH 35 // (formerly split up among emp, collision, etc) #define HUD_MESSAGE_BOX 36 +#ifndef FS2_DEMO #define HUD_SUPPORT_GAUGE 37 #define HUD_LAG_GAUGE 38 +#endif extern const char *HUD_gauge_text[NUM_HUD_GAUGES]; // defined in sexp.cpp!!!! diff --git a/include/ship.h b/include/ship.h index 74efcca..a216258 100644 --- a/include/ship.h +++ b/include/ship.h @@ -883,7 +883,9 @@ extern engine_wash_info Engine_wash_info[MAX_ENGINE_WASH_TYPES]; // DO NOT CHANGE THIS - IT WILL LIKELY BREAK FREESPACE2 PXO SUPPORT // TALK TO DAVE B FIRST // **************************************************************** -#ifdef MAKE_FS1 +#if defined(FS2_DEMO) +#define MAX_SHIP_TYPES 120 +#elif defined(MAKE_FS1) #define MAX_SHIP_TYPES 75 #else #define MAX_SHIP_TYPES 130 diff --git a/src/controlconfig/controlsconfigcommon.cpp b/src/controlconfig/controlsconfigcommon.cpp index 4ff82fc..61eff8f 100644 --- a/src/controlconfig/controlsconfigcommon.cpp +++ b/src/controlconfig/controlsconfigcommon.cpp @@ -541,8 +541,10 @@ config_item Control_config[CCFG_MAX + 1] = { #ifndef MAKE_FS1 { SDLK_l, -1, COMPUTER_TAB, "Toggle high HUD contrast", CC_TYPE_TRIGGER, -1, -1, 0 }, +#ifndef FS2_DEMO { KEY_SHIFTED | SDLK_n, -1, COMPUTER_TAB, "(Multiplayer) Toggle network info", CC_TYPE_TRIGGER, -1, -1, 0 }, { KEY_SHIFTED | SDLK_END, -1, COMPUTER_TAB, "(Multiplayer) Self destruct", CC_TYPE_TRIGGER, -1, -1, 0 }, +#endif #endif { -1, -1, -1, "", CC_TYPE_TRIGGER, -1, -1, 0 } }; diff --git a/src/hud/hud.cpp b/src/hud/hud.cpp index cf05f70..dc8a683 100644 --- a/src/hud/hud.cpp +++ b/src/hud/hud.cpp @@ -2168,18 +2168,34 @@ void hud_maybe_show_netlag_icon() // draw the net lag icon flashing hud_targetbox_start_flash(TBOX_FLASH_NETLAG); if(hud_targetbox_maybe_flash(TBOX_FLASH_NETLAG)){ +#ifdef FS2_DEMO + hud_set_gauge_color(HUD_RADAR, HUD_C_BRIGHT); +#else hud_set_gauge_color(HUD_LAG_GAUGE, HUD_C_BRIGHT); +#endif } else { +#ifdef FS2_DEMO + hud_set_gauge_color(HUD_RADAR); +#else hud_set_gauge_color(HUD_LAG_GAUGE); +#endif } gr_set_bitmap(Netlag_icon.first_frame, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); break; case 1: // draw the disconnected icon flashing fast if(hud_targetbox_maybe_flash(TBOX_FLASH_NETLAG,1)){ +#ifdef FS2_DEMO + hud_set_gauge_color(HUD_RADAR, HUD_C_BRIGHT); +#else hud_set_gauge_color(HUD_LAG_GAUGE, HUD_C_BRIGHT); +#endif } else { +#ifdef FS2_DEMO + hud_set_gauge_color(HUD_RADAR); +#else hud_set_gauge_color(HUD_LAG_GAUGE); +#endif } gr_set_bitmap(Netlag_icon.first_frame+1, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); break; @@ -2416,7 +2432,11 @@ void hud_support_view_blit() } // set hud color +#ifdef FS2_DEMO + hud_set_gauge_color(HUD_RADAR); +#else hud_set_gauge_color(HUD_SUPPORT_GAUGE); +#endif GR_AABITMAP(Support_view_gauge.first_frame, Support_view_coords[gr_screen.res][0], Support_view_coords[gr_screen.res][1]); diff --git a/src/hud/hudconfig.cpp b/src/hud/hudconfig.cpp index a4b0864..f3e4501 100644 --- a/src/hud/hudconfig.cpp +++ b/src/hud/hudconfig.cpp @@ -387,9 +387,13 @@ int HUD_config_default_flags2 = { (1<<(HUD_OFFSCREEN_RANGE-32)) | (1<<(HUD_KILLS_GAUGE-32)) | +#ifdef FS2_DEMO + (1<<(HUD_ATTACKING_TARGET_COUNT-32)) +#else (1<<(HUD_ATTACKING_TARGET_COUNT-32)) | (1<<(HUD_SUPPORT_GAUGE-32)) | (1<<(HUD_LAG_GAUGE-32)) +#endif }; // bits to tell whether a given gauge should be treated as pop-up or not @@ -552,8 +556,10 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] = HC_gauge_region("none", 1, 1, -1, 0, 0, -1, 0, 0), // attacking target count HC_gauge_region("HCB_38", 342, 138, 38, 0, 0, -1, 0, 0), // text flash gauge HC_gauge_region("HCB_52", 465, 8, 52, 0, 0, -1, 0, 0), // comm menu +#ifndef FS2_DEMO HC_gauge_region("HCB_46", 324, 264, 46, 0, 0, -1, 0, 0), // support view gauge HC_gauge_region("HCB_47", 418, 262, 47, 0, 0, -1, 0, 0), // netlag icon gauge +#endif #endif //XSTR:ON }, @@ -596,8 +602,10 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] = HC_gauge_region("none", 1, 1, -1, 0, 0, -1, 0, 0), // attacking target count HC_gauge_region("2_HCB_38", 548, 222, 38, 0, 0, -1, 0, 0), // text flash gauge HC_gauge_region("2_HCB_52", 744, 14, 52, 0, 0, -1, 0, 0), // comm menu +#ifndef FS2_DEMO HC_gauge_region("2_HCB_46", 520, 422, 46, 0, 0, -1, 0, 0), // support view gauge HC_gauge_region("2_HCB_47", 670, 419, 47, 0, 0, -1, 0, 0), // netlag icon gauge +#endif //XSTR:ON } }; diff --git a/src/io/keycontrol.cpp b/src/io/keycontrol.cpp index 38c68fa..c06a8c0 100644 --- a/src/io/keycontrol.cpp +++ b/src/io/keycontrol.cpp @@ -509,9 +509,11 @@ int Normal_key_set[] = { #ifndef MAKE_FS1 TOGGLE_HUD_CONTRAST, +#ifndef FS2_DEMO MULTI_TOGGLE_NETINFO, MULTI_SELF_DESTRUCT #endif +#endif }; int Dead_key_set[] = { @@ -635,9 +637,11 @@ int Non_critical_key_set[] = { #ifndef MAKE_FS1 TOGGLE_HUD_CONTRAST, +#ifndef FS2_DEMO MULTI_TOGGLE_NETINFO, MULTI_SELF_DESTRUCT #endif +#endif }; @@ -2796,6 +2800,7 @@ int button_function(int n) hud_toggle_contrast(); break; +#ifndef FS2_DEMO // toggle network info case MULTI_TOGGLE_NETINFO: extern int Multi_display_netinfo; @@ -2826,6 +2831,7 @@ int button_function(int n) send_self_destruct_packet(); } break; +#endif #endif // following are not handled here, but we need to bypass the Int3() case LAUNCH_COUNTERMEASURE: diff --git a/src/menuui/playermenu.cpp b/src/menuui/playermenu.cpp index 2266d45..d0d1ce3 100644 --- a/src/menuui/playermenu.cpp +++ b/src/menuui/playermenu.cpp @@ -613,7 +613,6 @@ void demo_title_blit() Mouse_hidden = 0; } } - #endif void player_select_do() diff --git a/src/mission/missioncampaign.cpp b/src/mission/missioncampaign.cpp index 0e6a1dd..985e5bf 100644 --- a/src/mission/missioncampaign.cpp +++ b/src/mission/missioncampaign.cpp @@ -258,13 +258,16 @@ static UI_BUTTON Campaign_okb, Campaign_cancelb; campaign Campaign; // variables with deal with the campaign save file -#ifndef MAKE_FS1 +#if defined(FS2_DEMO) +#define CAMPAIGN_FILE_VERSION 10 +#define CAMPAIGN_FILE_COMPATIBLE_VERSION CAMPAIGN_FILE_VERSION +#elif defined(MAKE_FS1) +#define CAMPAIGN_FILE_VERSION 7 +#define CAMPAIGN_FILE_COMPATIBLE_VERSION CAMPAIGN_INITIAL_RELEASE_FILE_VERSION +#else #define CAMPAIGN_FILE_VERSION 12 //#define CAMPAIGN_FILE_COMPATIBLE_VERSION CAMPAIGN_INITIAL_RELEASE_FILE_VERSION #define CAMPAIGN_FILE_COMPATIBLE_VERSION CAMPAIGN_FILE_VERSION -#else -#define CAMPAIGN_FILE_VERSION 7 -#define CAMPAIGN_FILE_COMPATIBLE_VERSION CAMPAIGN_INITIAL_RELEASE_FILE_VERSION #endif #define CAMPAIGN_FILE_ID 0xbeefcafe @@ -738,10 +741,11 @@ int mission_campaign_savefile_save() cfwrite_string_len( Campaign.filename, fp ); cfwrite_int( Campaign.prev_mission, fp ); cfwrite_int( Campaign.next_mission, fp ); -#ifndef MAKE_FS1 - cfwrite_int( Campaign.loop_reentry, fp ); - cfwrite_int( Campaign.loop_enabled, fp ); -#endif + + if (CAMPAIGN_FILE_VERSION >= 12) { + cfwrite_int( Campaign.loop_reentry, fp ); + cfwrite_int( Campaign.loop_enabled, fp ); + } // write out the information for ships/weapons which this player is allowed to use cfwrite_int(Num_ship_types, fp); @@ -964,10 +968,11 @@ void mission_campaign_savefile_load( const char *cfilename ) Campaign.prev_mission = cfread_int( fp ); Campaign.next_mission = cfread_int( fp ); -#ifndef MAKE_FS1 - Campaign.loop_reentry = cfread_int( fp ); - Campaign.loop_enabled = cfread_int( fp ); -#endif + + if (version >= 12) { + Campaign.loop_reentry = cfread_int( fp ); + Campaign.loop_enabled = cfread_int( fp ); + } // load information about ships/weapons allowed int ship_count, weapon_count; diff --git a/src/parse/sexp.cpp b/src/parse/sexp.cpp index b237b69..f6ed717 100644 --- a/src/parse/sexp.cpp +++ b/src/parse/sexp.cpp @@ -626,8 +626,10 @@ const char *HUD_gauge_text[NUM_HUD_GAUGES] = "ATTACKING TARGET COUNT", "TEXT FLASH", "MESSAGE BOX", +#ifndef FS2_DEMO "SUPPORT GUAGE", "LAG GUAGE" +#endif }; diff --git a/src/playerman/managepilot.cpp b/src/playerman/managepilot.cpp index e41d03d..0942b4b 100644 --- a/src/playerman/managepilot.cpp +++ b/src/playerman/managepilot.cpp @@ -237,19 +237,25 @@ #include "key.h" // update this when altering data that is read/written to .PLR file -#ifndef MAKE_FS1 -#define CURRENT_PLAYER_FILE_VERSION 140 -#else -// 99: original retail release (version 1.00) -// 100: retail mission pack update (version 1.04) -#define CURRENT_PLAYER_FILE_VERSION 100 -#define PREVIOUS_PLAYER_FILE_VERSION 99 -#endif -#define FS2_DEMO_PLAYER_FILE_VERSION 135 -#ifndef MAKE_FS1 -#define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION CURRENT_PLAYER_FILE_VERSION // demo plr files should work in final +#if defined(FS2_DEMO) + #define CURRENT_PLAYER_FILE_VERSION 136 // 1.10 + #define PREVIOUS_PLAYER_FILE_VERSION 135 // 1.00 + + #define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION PREVIOUS_PLAYER_FILE_VERSION +#elif defined(FS1_DEMO) + #define CURRENT_PLAYER_FILE_VERSION 94 // 1.20 + #define PREVIOUS_PLAYER_FILE_VERSION 86 // 1.00 + + #define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION PREVIOUS_PLAYER_FILE_VERSION +#elif defined(MAKE_FS1) + #define CURRENT_PLAYER_FILE_VERSION 100 // 1.04 + #define PREVIOUS_PLAYER_FILE_VERSION 99 // 1.00 + + #define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION PREVIOUS_PLAYER_FILE_VERSION #else -#define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION PREVIOUS_PLAYER_FILE_VERSION + #define CURRENT_PLAYER_FILE_VERSION 140 // 1.00 + + #define LOWEST_COMPATIBLE_PLAYER_FILE_VERSION CURRENT_PLAYER_FILE_VERSION // demo plr files should work in final #endif // keep track of pilot file changes here @@ -828,6 +834,10 @@ int read_pilot_file(const char *callsign, int single, player *p) } hud_config_set_color(HUD_config.main_color); +#elif defined(FS2_DEMO) + for(i=0; i