diff --git a/code/ai/aicode.cpp b/code/ai/aicode.cpp index 9a2cb7f5ff..dae5050a2b 100644 --- a/code/ai/aicode.cpp +++ b/code/ai/aicode.cpp @@ -10923,7 +10923,13 @@ void ai_guard() void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, int how ) { ai_info *aip, *repair_aip; - int stamp = -1; + int stamp = -1; + + int p_index; + int p_team; + + p_index = -1; + p_team = -1; // repaired_objp should not be null, but repair_objp will be null when a support ship is just warping in Assert(repaired_objp != NULL); @@ -10931,12 +10937,9 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, Assert( repaired_objp->type == OBJ_SHIP); aip = &Ai_info[Ships[repaired_objp->instance].ai_index]; - // multiplayer - int p_index; - p_index = -1; - if(Game_mode & GM_MULTIPLAYER){ - p_index = multi_find_player_by_object(repaired_objp); + p_index = multi_find_player_by_object(repaired_objp); + p_team = Net_players[p_index].p_info.team; } else { if(repaired_objp == Player_obj){ p_index = Player_num; @@ -11016,12 +11019,14 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, if ( p_index >= 0 ) { hud_support_view_abort(); - // send appropriate message to player here - if ( how == REPAIR_INFO_KILLED ){ - message_send_builtin_to_player( MESSAGE_SUPPORT_KILLED, NULL, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_SOON, 0, 0, p_index, -1 ); - } else { - if ( repair_objp ){ - message_send_builtin_to_player( MESSAGE_REPAIR_ABORTED, &Ships[repair_objp->instance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, p_index, -1 ); + // send appropriate messages here + if (MULTIPLAYER_MASTER) { + if ( how == REPAIR_INFO_KILLED ){ + message_send_builtin_to_player( MESSAGE_SUPPORT_KILLED, NULL, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_SOON, 0, 0, p_index, p_team ); + } else { + if ( repair_objp ){ + message_send_builtin_to_player( MESSAGE_REPAIR_ABORTED, &Ships[repair_objp->instance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, p_index, p_team ); + } } } } @@ -11040,8 +11045,10 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, Assert( repair_objp ); hud_support_view_stop(); - - message_send_builtin_to_player(MESSAGE_REPAIR_DONE, &Ships[repair_objp->instance], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, p_index, -1); + + if (MULTIPLAYER_MASTER) { + message_send_builtin_to_player(MESSAGE_REPAIR_DONE, &Ships[repair_objp->instance], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, p_index, p_team); + } } stamp = timestamp((int) ((30 + 10*frand()) * 1000)); break; diff --git a/code/fred2/fredview.cpp b/code/fred2/fredview.cpp index 3f2d1471bb..d37fe3e05a 100644 --- a/code/fred2/fredview.cpp +++ b/code/fred2/fredview.cpp @@ -4319,6 +4319,27 @@ void CFREDView::OnRunFreeSpace() si.cbReserved2 = 0; si.lpReserved2 = NULL; + // get the filename of the app and replace FRED2_Open with FS2_Open + std::string processed_name(AfxGetApp()->m_pszExeName); + std::string::size_type fred_index = processed_name.find("fred2_open", 0); + // capitalisation! + if (fred_index == std::string::npos) { + fred_index = processed_name.find("Fred2_Open", 0); + } + + if (fred_index != std::string::npos) { + // delete the fred2_open and add FS2_Open in its place + processed_name.erase(fred_index, 10); + processed_name.insert(fred_index, "FS2_Open"); + processed_name.append(".exe"); + + //try to start FS2_open + r = CreateProcess(processed_name.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi); + if (r) { + return; + } + } + r = CreateProcess("start_fs2.bat", NULL, NULL, NULL, FALSE, 0, NULL, "./", &si, &pi); if (!r) { diff --git a/code/fred2/modifyvariabledlg.cpp b/code/fred2/modifyvariabledlg.cpp index 59ff709f7f..62c4e3a99b 100644 --- a/code/fred2/modifyvariabledlg.cpp +++ b/code/fred2/modifyvariabledlg.cpp @@ -277,7 +277,7 @@ BOOL CModifyVariableDlg::OnInitDialog() // initialize list -- Box is set to *not* sort for (i=0; iAddString(Sexp_variables[i].variable_name); // check no error diff --git a/code/fred2/sexp_tree.cpp b/code/fred2/sexp_tree.cpp index 497aca646b..45369b746a 100644 --- a/code/fred2/sexp_tree.cpp +++ b/code/fred2/sexp_tree.cpp @@ -1543,6 +1543,11 @@ void sexp_tree::right_clicked(int mode) for (int idx=0; idx= 0) { + if ( bm_release(gr_screen.envmap_render_target, 1) ) { + gr_screen.envmap_render_target = -1; + } + } + + gr_set_ambient_light(120, 120, 120); + + ENVMAP = Default_env_map; } else { @@ -3692,6 +3702,7 @@ void game_init() Cmdline_glow = 0; Cmdline_env = 0; Cmdline_3dwarp = 0; + Cmdline_normal = 0; // now init the standalone server code std_init_standalone(); @@ -6709,6 +6720,13 @@ void game_set_frametime(int state) Frametime = fixmul(Frametime, Game_time_compression); + if (Frametime <= 0) + { + // If the Frametime is zero or below due to Game_time_compression, set + // the Frametime to 1 (1/65536 of a second). + Frametime = 1; + } + Last_time = thistime; //mprintf(("Frame %i, Last_time = %7.3f\n", Framecount, f2fl(Last_time))); diff --git a/code/globalincs/windebug.cpp b/code/globalincs/windebug.cpp index 8bd0968b68..1f2bd5c354 100644 --- a/code/globalincs/windebug.cpp +++ b/code/globalincs/windebug.cpp @@ -306,6 +306,8 @@ bool Messagebox_active = false; #ifdef SHOW_CALL_STACK +static bool Dump_to_log = true; + class DumpBuffer { public : @@ -473,8 +475,12 @@ void PE_Debug :: DumpLineNumber( DumpBuffer& dumpBuffer, DWORD relativeAddress ) } line++ ; } - if( lineNum != none ) + if( lineNum != none ) { dumpBuffer.Printf( " line %d\r\n", lineNum ) ; + if (Dump_to_log) { + mprintf(( " line %d\r\n", lineNum )) ; + } + } // else // dumpBuffer.Printf( " line \r\n" ) ; } @@ -725,8 +731,14 @@ void PE_Debug::DumpSymbolInfo( DumpBuffer& dumpBuffer, DWORD relativeAddress ) char tmp_name[1024]; unmangle(tmp_name, GetSymbolName( fnSymbol ) ); dumpBuffer.Printf( " %s()", tmp_name ) ; + if (Dump_to_log) { + mprintf((" %s()", tmp_name )) ; + } } else { dumpBuffer.Printf( " " ) ; + if (Dump_to_log) { + mprintf((" " )) ; + } } } @@ -888,6 +900,9 @@ int PE_Debug::DumpDebugInfo( DumpBuffer& dumpBuffer, const BYTE* caller, HINSTAN //dumpBuffer.Printf( "Call stack is unavailable, because there is\r\nno COFF debugging info in this module.\r\n" ) ; //JAS dumpBuffer.Printf( " no debug information\r\n" ) ; dumpBuffer.Printf( " %s %08x()\r\n", pretty_module, caller ) ; + if (Dump_to_log) { + mprintf((" %s %08x()\r\n", pretty_module, caller )) ; + } return 0; } } catch( ... ) { @@ -896,6 +911,9 @@ int PE_Debug::DumpDebugInfo( DumpBuffer& dumpBuffer, const BYTE* caller, HINSTAN } } else { dumpBuffer.Printf( " %s %08x()\r\n", pretty_module, caller ) ; + if (Dump_to_log) { + mprintf(( " %s %08x()\r\n", pretty_module, caller )) ; + } //JAS dumpBuffer.Printf( " module not accessible\r\n" ) ; //JAS dumpBuffer.Printf( " address: %8X\r\n", caller ) ; return 0; @@ -1030,18 +1048,16 @@ void _cdecl WinAssert(char * text, char * filename, int linenum ) filename = strrchr(filename, '\\')+1; sprintf( AssertText1, "Assert: %s\r\nFile: %s\r\nLine: %d\r\n", text, filename, linenum ); -#ifdef SHOW_CALL_STACK + // this stuff migt be really useful for solving bug reports and user errors. We should output it! + mprintf(("ASSERTION: %s\r\nFile: %s\r\nLine: %d\r\n", text, filename, linenum )); + +#ifdef SHOW_CALL_STACK dumpBuffer.Clear(); dumpBuffer.Printf( AssertText1 ); dumpBuffer.Printf( "\r\n" ); DumpCallsStack( dumpBuffer ) ; dump_text_to_clipboard(dumpBuffer.buffer); - // this stuff migt be really useful for solving bug reports and user errors! We should output it! - mprintf(("ASSERTION: %s\r\nFile: %s\r\nLine: %d\r\n", text, filename, linenum )); - mprintf((dumpBuffer.buffer)); - - dumpBuffer.Printf( "\r\n[ This info is in the clipboard so you can paste it somewhere now ]\r\n" ); dumpBuffer.Printf( "\r\n\r\nUse Ok to break into Debugger, Cancel to exit.\r\n"); @@ -1181,6 +1197,7 @@ void _cdecl Error( char * filename, int line, const char * format, ... ) filename = strrchr(filename, '\\')+1; sprintf(AssertText2, "Error: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line); + mprintf(("ERROR: %s\r\nFile: %s\r\nLine: %d\r\n", AssertText1, filename, line)); Messagebox_active = true; @@ -1274,6 +1291,9 @@ void _cdecl Warning( char *filename, int line, const char *format, ... ) gr_activate(0); #ifdef SHOW_CALL_STACK + //we don't want to dump the call stack for every single warning + Dump_to_log = false; + dumpBuffer.Clear(); dumpBuffer.Printf( AssertText2 ); dumpBuffer.Printf( "\r\n" ); @@ -1284,6 +1304,9 @@ void _cdecl Warning( char *filename, int line, const char *format, ... ) dumpBuffer.Printf("\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit"); result = MessageBox((HWND)os_get_window(), dumpBuffer.buffer, "Warning!", MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING | flags ); + + Dump_to_log = true; + #else strcat(AssertText2,"\r\n\r\nUse Yes to break into Debugger, No to continue.\r\nand Cancel to Quit"); result = MessageBox((HWND)os_get_window(), AssertText2, "Warning!", MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING | flags ); diff --git a/code/hud/hudescort.cpp b/code/hud/hudescort.cpp index c75980b8fd..00215bd5e9 100644 --- a/code/hud/hudescort.cpp +++ b/code/hud/hudescort.cpp @@ -211,6 +211,7 @@ #include "network/multi.h" #include "network/multiutil.h" #include "iff_defs/iff_defs.h" +#include "parse/parselo.h" int Show_escort_view; @@ -836,6 +837,7 @@ void hud_escort_show_icon(int x, int y, int index) // print out ship name strcpy(buf, sp->ship_name); gr_force_fit_string(buf, 255, 100); + end_string_at_first_hash_symbol(buf); emp_hud_string( x + current_hud->Escort_name[0], y + current_hud->Escort_name[1], EG_ESCORT1 + index, buf); @@ -975,6 +977,12 @@ void hud_add_ship_to_escort(int objnum, int supress_feedback) // get complete escort list hud_create_complete_escort_list(complete_escorts, &num_complete_escorts); + // ensure the complete escort list is not full already + if (num_complete_escorts == MAX_COMPLETE_ESCORT_LIST) + { + return; + } + // check if ship is already on complete escort list found = 0; for (idx=0; idxinstance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, multi_player_num, -1 ); + message_send_builtin_to_player( MESSAGE_ON_WAY, &Ships[robjp->instance], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, multi_player_num, multi_player_team ); } else { // if we are in this part of the if statment, a support ship has been warped in to // service us. Issue appropriate message - message_send_builtin_to_player( MESSAGE_REARM_WARP, NULL, MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, multi_player_num, -1 ); + message_send_builtin_to_player( MESSAGE_REARM_WARP, NULL, MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_SOON, 0, 0, multi_player_num, multi_player_team ); } mission_log_add_entry(LOG_PLAYER_CALLED_FOR_REARM, Ships[tobj->instance].ship_name, NULL); @@ -1547,6 +1552,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, int message; int target_team, ship_team; // team id's for the ship getting message and any target the player has ship *ordering_shipp; + + int message_team_filter = -1; // quick short circuit here because of actually showing comm menu even though you cannot message. // just a safety net. @@ -1568,6 +1575,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, if ( player_num != -1 ){ ainfo = &Ai_info[Ships[Objects[Net_players[player_num].m_player->objnum].instance].ai_index]; + message_team_filter = Net_players[player_num].p_info.team; } Assert( ainfo->shipnum != -1 ); @@ -1793,7 +1801,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, // this is the _response_ if ( send_message && (!(Ships[shipnum].flags2 & SF2_NO_BUILTIN_MESSAGES))) { - message_send_builtin_to_player( message, &Ships[shipnum], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_ANYTIME, 0, 0, player_num, -1 ); + message_send_builtin_to_player( message, &Ships[shipnum], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_ANYTIME, 0, 0, player_num, message_team_filter ); } return send_message; @@ -1814,6 +1822,8 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, int target_team, wing_team; // team for the wing and the player's target ship *ordering_shipp; + int message_team_filter = -1; + // quick short circuit here because of actually showing comm menu even though you cannot message. // just a safety net. if ( (Game_mode & GM_MULTIPLAYER) && (player_num != -1) ) { @@ -1832,8 +1842,10 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, ai_submode = -1234567; ainfo = Player_ai; - if ( player_num != -1 ) + if ( player_num != -1 ) { ainfo = &Ai_info[Ships[Objects[Net_players[player_num].m_player->objnum].instance].ai_index]; + message_team_filter = Net_players[player_num].p_info.team; + } Assert( ainfo->shipnum != -1 ); ordering_shipp = &Ships[ainfo->shipnum]; @@ -2011,7 +2023,7 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, // menu, but the get_random_ship* functions won't return dying ships. // Karajorma - No valid ships will be found if all the remaining ships have been silence either. if ( ship_num != -1 ) { - message_send_builtin_to_player( message, &Ships[ship_num], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_ANYTIME, 0, 0, player_num, -1 ); + message_send_builtin_to_player( message, &Ships[ship_num], MESSAGE_PRIORITY_NORMAL, MESSAGE_TIME_ANYTIME, 0, 0, player_num, message_team_filter ); message_sent = 1; } } diff --git a/code/mission/missionparse.cpp b/code/mission/missionparse.cpp index 6e6f87ef70..ebf1224a47 100644 --- a/code/mission/missionparse.cpp +++ b/code/mission/missionparse.cpp @@ -4888,7 +4888,7 @@ void parse_wing(mission *pm) // 7/13/98 -- MWA // error checking against the player ship wings (i.e. starting & tvt) to be sure that wave count doesn't exceed one for // these wings. - if ( Game_mode & GM_MULTIPLAYER ) { + if ( MULTI_NOT_TEAM ) { for (i = 0; i < MAX_STARTING_WINGS; i++ ) { if ( !stricmp(Starting_wing_names[i], wingp->name) ) { if ( wingp->num_waves > 1 ) { @@ -4900,6 +4900,8 @@ void parse_wing(mission *pm) } } } + } + else if (MULTI_TEAM) { for (i = 0; i < MAX_TVT_WINGS; i++ ) { if ( !stricmp(TVT_wing_names[i], wingp->name) ) { if ( wingp->num_waves > 1 ) { diff --git a/code/network/multimsgs.cpp b/code/network/multimsgs.cpp index f71ef37ff0..06278d93a9 100644 --- a/code/network/multimsgs.cpp +++ b/code/network/multimsgs.cpp @@ -3244,7 +3244,7 @@ void process_ship_create_packet( ubyte *data, header *hinfo ) Arriving_support_ship->net_signature = signature; objnum = parse_create_object( Arriving_support_ship ); Assert( objnum != -1 ); - if(objnum < 0){ + if(objnum >= 0){ mission_parse_support_arrived( objnum ); } } @@ -3971,8 +3971,9 @@ void process_mission_message_packet( ubyte *data, header *hinfo ) PACKET_SET_SIZE(); - // filter out builtin ones in TvT - if((builtin_type >= 0) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL) && (Net_player->p_info.team != multi_team_filter)){ + // filter out some builtin ones in TvT + if((builtin_type >= 0) && (Netgame.type_flags & NG_TYPE_TEAM) && (Net_player != NULL) && (Net_player->p_info.team != multi_team_filter)) { + mprintf(("Builtin message of type %d filtered out in process_mission_message_packet()\n", id)); return; } diff --git a/code/network/multiutil.cpp b/code/network/multiutil.cpp index 3593338ae2..c14169ee5b 100644 --- a/code/network/multiutil.cpp +++ b/code/network/multiutil.cpp @@ -2035,8 +2035,17 @@ void multi_create_standalone_object() int multi_message_should_broadcast(int type) { - return (type == MESSAGE_ARRIVE_ENEMY) || (type == MESSAGE_BETA_ARRIVED) || - (type == MESSAGE_GAMMA_ARRIVED) || (type == MESSAGE_HELP) || (type == MESSAGE_REINFORCEMENTS) ? 1 : 0; + switch (type) { + case MESSAGE_ARRIVE_ENEMY: + case MESSAGE_BETA_ARRIVED: + case MESSAGE_GAMMA_ARRIVED: + case MESSAGE_HELP: + case MESSAGE_REINFORCEMENTS: + case MESSAGE_SUPPORT_KILLED: + return 1; + default: + return 0; + } } // active game list handling functions diff --git a/code/osapi/osapi.cpp b/code/osapi/osapi.cpp index 048b7dae8e..76642132d9 100644 --- a/code/osapi/osapi.cpp +++ b/code/osapi/osapi.cpp @@ -613,6 +613,11 @@ void change_window_active_state() #endif disableWindowsKey(); + + if (!Cmdline_window) + { + SetWindowPos(hwndApp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + } } else { joy_unacquire_ff(); @@ -627,6 +632,11 @@ void change_window_active_state() #endif enableWindowsKey(); + + if (!Cmdline_window) + { + SetWindowPos(hwndApp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + } } gr_activate(fAppActive); diff --git a/code/parse/lua.cpp b/code/parse/lua.cpp index 9c19e8a495..e04967c601 100644 --- a/code/parse/lua.cpp +++ b/code/parse/lua.cpp @@ -9050,6 +9050,18 @@ ADE_FUNC(isCurrentPlayerMulti, l_Testing, NULL, "Returns whether current player return ADE_RETURN_TRUE; } +// Om_tracker_flag should already be set in FreeSpace.cpp, needed to determine if PXO is enabled from the registry +extern int Om_tracker_flag; // needed for FS2OpenPXO config + +ADE_FUNC(isPXOEnabled, l_Testing, NULL, "Returns whether PXO is currently enabled in the configuration.", "boolean", "Whether PXO is enabled or not") +{ + if(!(Om_tracker_flag)) + return ADE_RETURN_FALSE; + + return ADE_RETURN_TRUE; +} + + // *************************Helper functions********************* //WMC - This should be used anywhere that an 'object' is set, so //that scripters can get access to as much relevant data to that diff --git a/code/parse/sexp.cpp b/code/parse/sexp.cpp index 66c54fb882..5a1bec9837 100644 --- a/code/parse/sexp.cpp +++ b/code/parse/sexp.cpp @@ -8015,27 +8015,7 @@ int eval_in_sequence(int arg_handler_node, int condition_node) int n = -1 ; Assert(arg_handler_node != -1 && condition_node != -1); - - /* - // Disabled due to problems with query_sexp_args_count (n, true). Those problems should be fixed now - // but the newer code is more heavily tested and should be safer so I'm sticking with that for now. - // get the number of valid arguments - n = CDR(arg_handler_node); - int num_valid_args = query_sexp_args_count(arg_handler_node, true); - - if (num_valid_args == 0) - { - Sexp_current_replacement_argument = NULL; - return SEXP_FALSE; - } - - // find the first valid argument. we know that there must be one thanks to the check above - while (!(Sexp_nodes[n].flags & SNF_ARGUMENT_VALID)) - { - n = CDR(n); - }*/ - // get the first argument n = CDR(arg_handler_node); Assert (n != -1); diff --git a/code/ship/ship.cpp b/code/ship/ship.cpp index c7ee926668..d99a59d9d2 100644 --- a/code/ship/ship.cpp +++ b/code/ship/ship.cpp @@ -2817,7 +2817,7 @@ void init_ship_entry(ship_info *sip) int i,j; sip->name[0] = '\0'; - sprintf(sip->short_name, "AShipClass"); + sprintf(sip->short_name, "ShipClass%d", (sip - Ship_info)); sip->species = 0; sip->class_type = -1; @@ -3197,7 +3197,7 @@ int parse_ship_template() init_ship_entry(sip); strcpy(sip->name, buf); - //Use another template for this template. This allows for template heirarchies. - Turey + //Use another template for this template. This allows for template hierarchies. - Turey if( optional_string("+Use Template:") ) { char template_name[SHIP_MULTITEXT_LENGTH]; stuff_string(template_name, F_NAME, SHIP_MULTITEXT_LENGTH); @@ -3491,7 +3491,7 @@ int parse_ship_values(ship_info* sip, bool isTemplate, bool first_time, bool rep stuff_vector(&sip->max_vel); // calculate the max speed from max_velocity - sip->max_speed = vm_vec_mag(&sip->max_vel); + sip->max_speed = sip->max_vel.xyz.z; if(optional_string("$Rotation Time:")) { @@ -7203,42 +7203,33 @@ void ship_render(object * obj) } //secondary weapons - + int num_secondaries_rendered = 0; + vec3d secondary_weapon_pos; + w_bank* bank; + for (i = 0; i < swp->num_secondary_banks; i++) { if (Weapon_info[swp->secondary_bank_weapons[i]].external_model_num == -1 || !sip->draw_secondary_models[i]) continue; - w_bank *bank = &model_get(sip->model_num)->missile_banks[i]; - for(k = 0; k < bank->num_slots; k++) { - vec3d secondary_weapon_pos = bank->pnt[k]; - // vm_vec_add(&secondary_weapon_pos, &obj->pos, &bank->pnt[k]); - - // if(shipp->secondary_point_reload_pct[i][k] != 1.0) - // vm_vec_scale_add2(&secondary_weapon_pos, &obj->orient.vec.fvec, -(1.0f-shipp->secondary_point_reload_pct[i][k]) * model_get(Weapon_info[swp->secondary_bank_weapons[i]].model_num)->rad); - if(shipp->secondary_point_reload_pct[i][k] <= 0.0) - continue; - - vec3d dir = ZERO_VECTOR; - dir.xyz.z = 1.0; - - bool clipping = false; - - /* extern int G3_user_clip; - - if(!G3_user_clip){ - vec3d clip_pnt; - vm_vec_rotate(&clip_pnt, &bank->pnt[k], &obj->orient); - vm_vec_add2(&clip_pnt, &obj->pos); - g3_start_user_clip_plane(&clip_pnt,&obj->orient.vec.fvec); - clipping = true; - } - */ + bank = &(model_get(sip->model_num))->missile_banks[i]; + + num_secondaries_rendered = 0; + + for(k = 0; k < bank->num_slots; k++) + { + secondary_weapon_pos = bank->pnt[k]; - vm_vec_scale_add2(&secondary_weapon_pos, &dir, -(1.0f-shipp->secondary_point_reload_pct[i][k]) * model_get(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num)->rad); + if (num_secondaries_rendered >= shipp->weapons.secondary_bank_ammo[i]) + break; + + if(shipp->secondary_point_reload_pct[i][k] <= 0.0) + continue; + + num_secondaries_rendered++; + + vm_vec_scale_add2(&secondary_weapon_pos, &vmd_z_vector, -(1.0f-shipp->secondary_point_reload_pct[i][k]) * model_get(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num)->rad); model_render(Weapon_info[swp->secondary_bank_weapons[i]].external_model_num, &vmd_identity_matrix, &secondary_weapon_pos, render_flags); - if(clipping) - g3_stop_user_clip_plane(); } } g3_done_instance(true); @@ -9848,6 +9839,10 @@ void change_ship_type(int n, int ship_type, int by_sexp) shield_set_strength(objp, shield_pct * sp->ship_max_shield_strength); } + // make sure that shields are enabled if they need to be + if (sp->ship_max_shield_strength > 0.0f) { + objp->flags &= ~OF_NO_SHIELDS; + } // Goober5000: div-0 checks Assert(sp->ship_max_hull_strength > 0.0f); @@ -9868,8 +9863,6 @@ void change_ship_type(int n, int ship_type, int by_sexp) sp->current_max_speed = sip->max_speed * (sp->current_max_speed / sip_orig->max_speed); - sp->afterburner_fuel = sip->afterburner_fuel_capacity; - ship_set_default_weapons(sp, sip); physics_ship_init(&Objects[sp->objnum]); ets_init_ship(&Objects[sp->objnum]); diff --git a/code/ship/shipfx.cpp b/code/ship/shipfx.cpp index 546774532c..a1ebb8ba5f 100644 --- a/code/ship/shipfx.cpp +++ b/code/ship/shipfx.cpp @@ -4562,7 +4562,7 @@ int WE_BTRL::warpShipRender() return 0; //Figure out which frame we're on - int frame = fl2i((float)((float)(timestamp() - (float)total_time_start) / (float)(total_time_end - (float)total_time_start)) * (float)(anim_nframes) + 0.5); + int frame = fl2i((float)((float)(timestamp() - (float)total_time_start) / (float)(total_time_end - (float)total_time_start)) * (float)(anim_nframes-1) + 0.5); if ( frame > (anim_nframes-1) ) { //frame = (anim_nframes-1); diff --git a/code/ship/shiphit.cpp b/code/ship/shiphit.cpp index 6347a43cb5..c7c766a193 100644 --- a/code/ship/shiphit.cpp +++ b/code/ship/shiphit.cpp @@ -3072,7 +3072,10 @@ void ship_apply_wash_damage(object *ship_obj, object *other_obj, float damage) // player pain void ship_hit_pain(float damage) { - game_flash( damage/15.0f, -damage/30.0f, -damage/30.0f ); + if (!(Player_obj->flags & OF_INVULNERABLE)) + { + game_flash( damage/15.0f, -damage/30.0f, -damage/30.0f ); + } // kill any active popups when you get hit. if ( Game_mode & GM_MULTIPLAYER ){ diff --git a/code/stats/scoring.cpp b/code/stats/scoring.cpp index 3dca980d8e..2a6a962b4e 100644 --- a/code/stats/scoring.cpp +++ b/code/stats/scoring.cpp @@ -810,6 +810,7 @@ void scoring_eval_kill(object *ship_obj) net_player *dead_plr = NULL; float scoring_scale_by_damage = 1; // percentage to scale the killer's score by if we score based on the amount of damage caused int kill_score, assist_score; + bool is_enemy_player = false; // true if the player just killed an enemy player ship // multiplayer clients bail here @@ -835,6 +836,7 @@ void scoring_eval_kill(object *ship_obj) Net_players[net_player_num].m_player->stats.m_player_deaths++; nprintf(("Network","Setting player %s deaths to %d\n",Net_players[net_player_num].m_player->callsign,Net_players[net_player_num].m_player->stats.m_player_deaths)); dead_plr = &Net_players[net_player_num]; + is_enemy_player = true; } } else { if(ship_obj == Player_obj){ @@ -963,7 +965,16 @@ void scoring_eval_kill(object *ship_obj) } else { plr->stats.m_okKills[si_index]++; plr->stats.m_kill_count_ok++; - kill_score = (int)(dead_ship->score * scoring_get_scale_factor() * scoring_scale_by_damage); + + // only computer controlled enemies should scale with difficulty + if (is_enemy_player) { + kill_score = (int)(dead_ship->score * scoring_scale_by_damage); + } + else { + kill_score = (int)(dead_ship->score * scoring_get_scale_factor() * scoring_scale_by_damage); + } + + plr->stats.m_score += kill_score; hud_gauge_popup_start(HUD_KILLS_GAUGE); @@ -1039,7 +1050,7 @@ void scoring_eval_kill(object *ship_obj) // pass in the guy who got the credit for the kill (if any), so that he doesn't also // get credit for an assist - scoring_eval_assists(dead_ship,killer_sig); + scoring_eval_assists(dead_ship,killer_sig, is_enemy_player); // bash damage_ship_id[0] with the signature of the guy who is getting credit for the kill dead_ship->damage_ship_id[0] = killer_sig; @@ -1075,13 +1086,14 @@ void scoring_eval_kill(object *ship_obj) // kill_id is the object signature of the guy who got the credit for the kill (may be -1, if no one got it) // this is to ensure that you don't also get an assist if you get the kill. -void scoring_eval_assists(ship *sp,int killer_sig) +void scoring_eval_assists(ship *sp,int killer_sig, bool is_enemy_player) { int idx; player *plr; float scoring_scale_by_damage = 1; // percentage to scale the score by if we score based on the amount of damage caused int assist_score; int net_player_num; + float scoring_scale_factor; // multiplayer clients bail here @@ -1119,15 +1131,25 @@ void scoring_eval_assists(ship *sp,int killer_sig) nprintf(("Network","-==============GAVE PLAYER %s AN ASSIST=====================-\n",plr->callsign)); } + // Don't scale in TvT and dogfight + if (is_enemy_player) { + Assert(Game_mode & GM_MULTIPLAYER); + scoring_scale_factor = 1.0f; + } + else { + scoring_scale_factor = scoring_get_scale_factor(); + } + + // maybe award assist points based on damage if (The_mission.ai_profile->flags & AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE) { scoring_scale_by_damage = (sp->damage_ship[idx]/sp->total_damage_received); - assist_score = (int)(sp->score * scoring_get_scale_factor() * scoring_scale_by_damage); + assist_score = (int)(sp->score * scoring_scale_factor * scoring_scale_by_damage); plr->stats.m_score += assist_score; } // otherwise give the points based on the percentage in the mission file else { - assist_score = (int)(sp->score * sp->assist_score_pct * scoring_get_scale_factor() ); + assist_score = (int)(sp->score * sp->assist_score_pct * scoring_scale_factor ); plr->stats.m_score += assist_score; } diff --git a/code/stats/scoring.h b/code/stats/scoring.h index 7838d61ffb..eff227a854 100644 --- a/code/stats/scoring.h +++ b/code/stats/scoring.h @@ -328,7 +328,7 @@ void scoring_check_medal(scoring_struct *sc); void scoring_add_damage(object *ship_obj,object *other_obj,float damage); void scoring_eval_kill(object *ship_obj); -void scoring_eval_assists(ship *sp,int killer_sig); +void scoring_eval_assists(ship *sp,int killer_sig, bool enemy_player = false); // bash the passed player to the specified rank void scoring_bash_rank(player *pl,int rank); diff --git a/code/weapon/beam.cpp b/code/weapon/beam.cpp index 2282519236..abe33a1fb7 100644 --- a/code/weapon/beam.cpp +++ b/code/weapon/beam.cpp @@ -3405,9 +3405,12 @@ void beam_handle_collisions(beam *b) } // if the damage timestamp has expired or is not set yet, apply damage - if((r_coll[r_coll_count].c_stamp == -1) || timestamp_elapsed(r_coll[r_coll_count].c_stamp)){ - do_damage = 1; - r_coll[r_coll_count].c_stamp = timestamp(BEAM_DAMAGE_TIME); + if((r_coll[r_coll_count].c_stamp == -1) || timestamp_elapsed(r_coll[r_coll_count].c_stamp)) + { + float time_compression = f2fl(Game_time_compression); + float delay_time = i2fl(BEAM_DAMAGE_TIME) / time_compression; + do_damage = 1; + r_coll[r_coll_count].c_stamp = timestamp(fl2i(delay_time)); } // if no damage - don't even indicate it has been hit diff --git a/code/weapon/weapons.cpp b/code/weapon/weapons.cpp index 4c9d32e6b0..7142daecce 100644 --- a/code/weapon/weapons.cpp +++ b/code/weapon/weapons.cpp @@ -4890,21 +4890,14 @@ void weapon_home(object *obj, int num, float frame_time) // If a weapon has missed its target, detonate it. // This solves the problem of a weapon circling the center of a subsystem that has been blown away. // Problem: It does not do impact damage, just proximity damage. - if ((dist_to_target < flFrametime * obj->phys_info.speed * 4.0f + 10.0f) && (old_dot < 0.0f)) { - int kill_missile = TRUE; - if (wp->homing_object) { - if (wp->homing_object->type == OBJ_SHIP) { - ship *shipp = &Ships[wp->homing_object->instance]; - if (shipp->flags2 & SF2_DONT_COLLIDE_INVIS) { - kill_missile = FALSE; - } - } - } - - if (kill_missile && (wp->lifeleft > 0.01f)) { - wp->lifeleft = 0.01f; - } - } + if ((dist_to_target < flFrametime * obj->phys_info.speed * 4.0f + 10.0f) && + (old_dot < wip->fov) && + (wp->lifeleft > 0.01f) && + (wp->homing_object) && + (wp->homing_object->type == OBJ_SHIP)) + { + wp->lifeleft = 0.01f; + } // Only lead target if more than one second away. Otherwise can miss target. I think this // is what's causing Harbingers to miss the super destroyer. -- MK, 4/15/98 diff --git a/projects/MSVC_2003/Freespace2.vcproj b/projects/MSVC_2003/Freespace2.vcproj index 84063e0d7a..81df5a1265 100644 --- a/projects/MSVC_2003/Freespace2.vcproj +++ b/projects/MSVC_2003/Freespace2.vcproj @@ -25,8 +25,11 @@ OptimizeForWindowsApplication="TRUE" AdditionalIncludeDirectories="..\..\code,..\..\lua" PreprocessorDefinitions="_DEBUG;AL_VERSION_1_1;WIN32;_WINDOWS;FS2_SPEECH;USE_OPENAL;NO_DIRECT3D" + MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" + BufferSecurityCheck="TRUE" + EnableFunctionLevelLinking="TRUE" UsePrecompiledHeader="2" PrecompiledHeaderFile="$(ConfigurationName)\Intermediate\freespace2.pch" AssemblerListingLocation="$(IntDir)/" diff --git a/projects/MSVC_2003/code.vcproj b/projects/MSVC_2003/code.vcproj index 496744f1de..c4a8e8bea3 100644 --- a/projects/MSVC_2003/code.vcproj +++ b/projects/MSVC_2003/code.vcproj @@ -717,12 +717,21 @@ + + + + + + @@ -739,12 +748,21 @@ + + + + + + diff --git a/projects/MSVC_2008/Fred2.vcproj b/projects/MSVC_2008/Fred2.vcproj index 010834c50c..22fae3725b 100644 --- a/projects/MSVC_2008/Fred2.vcproj +++ b/projects/MSVC_2008/Fred2.vcproj @@ -87,6 +87,7 @@ LinkIncremental="2" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libcmt.lib,libci.lib" GenerateDebugInformation="true" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" @@ -200,6 +201,7 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" GenerateMapFile="true" @@ -313,6 +315,7 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" GenerateMapFile="true" @@ -426,6 +429,7 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" GenerateMapFile="true" diff --git a/projects/MSVC_2008/Freespace2.vcproj b/projects/MSVC_2008/Freespace2.vcproj index 8544e59659..37129bc9b8 100644 --- a/projects/MSVC_2008/Freespace2.vcproj +++ b/projects/MSVC_2008/Freespace2.vcproj @@ -90,6 +90,7 @@ LinkIncremental="2" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libcmt.lib,libci.lib" GenerateDebugInformation="true" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" @@ -202,6 +203,7 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" GenerateDebugInformation="true" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" @@ -317,6 +319,7 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" GenerateDebugInformation="true" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb" @@ -432,6 +435,8 @@ LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(ConfigurationName),../../oggvorbis/lib,../../dx8sdk/lib,../../openal/libs/win32,../../openal/libs/win64" + EnableUAC="false" + UACUIAccess="false" IgnoreDefaultLibraryNames="libc.lib,libcd.lib,libci.lib" GenerateDebugInformation="true" ProgramDatabaseFile="$(TargetDir)$(TargetName).pdb"