void mission_goal_status_change( int goal_num, int new_status) { int type; Assert(goal_num < Num_goals); Assert((new_status == GOAL_FAILED) || (new_status == GOAL_COMPLETE)); // if in a multiplayer game, send a status change to clients if ( MULTIPLAYER_MASTER ){ send_mission_goal_info_packet( goal_num, new_status, -1 ); } type = Mission_goals[goal_num].type & GOAL_TYPE_MASK; Mission_goals[goal_num].satisfied = new_status; if ( new_status == GOAL_FAILED ) { // don't display bonus goal failure if ( type != BONUS_GOAL ) { // only do HUD and music is goals are my teams goals. if ( (Game_mode & GM_NORMAL) || ((Net_player != NULL) && (Net_player->p_info.team == Mission_goals[goal_num].team)) ) { hud_add_objective_messsage(type, new_status); if ( !Mission_goals[goal_num].flags & MGF_NO_MUSIC ) { // maybe play event music event_music_primary_goal_failed(); } //HUD_sourced_printf(HUD_SOURCE_FAILED, "%s goal failed at time %6.1f!", Goal_type_text(type), f2fl(Missiontime) ); } } mission_log_add_entry( LOG_GOAL_FAILED, Mission_goals[goal_num].name, NULL, goal_num ); } else if ( new_status == GOAL_COMPLETE ) { if ( (Game_mode & GM_NORMAL) || ((Net_player != NULL) && (Net_player->p_info.team == Mission_goals[goal_num].team))) { hud_add_objective_messsage(type, new_status); // cue for Event Music if ( !(Mission_goals[goal_num].flags & MGF_NO_MUSIC) ) { event_music_primary_goals_met(); } mission_log_add_entry( LOG_GOAL_SATISFIED, Mission_goals[goal_num].name, NULL, goal_num ); } if(Game_mode & GM_MULTIPLAYER){ // squad war multi_team_maybe_add_score((int)(Mission_goals[goal_num].score * scoring_get_scale_factor()), Mission_goals[goal_num].team); } else { // deal with the score Player->stats.m_score += (int)(Mission_goals[goal_num].score * scoring_get_scale_factor()); } } }
// function used to actually change the status (valid/invalid) of a goal. Called externally // with multiplayer code void mission_goal_validation_change( int goal_num, int valid ) { // only incomplete goals can have their status changed if ( Mission_goals[goal_num].satisfied != GOAL_INCOMPLETE ){ return; } // if in multiplayer, then send a packet if ( MULTIPLAYER_MASTER ){ send_mission_goal_info_packet( goal_num, -1, valid ); } // change the valid status if ( valid ){ Mission_goals[goal_num].type &= ~INVALID_GOAL; } else { Mission_goals[goal_num].type |= INVALID_GOAL; } }