|
Wing Commander
Reconstructed Win32 source (1996)
|
Collision avoidance, formation flying and manoeuvre selection. More...
Go to the source code of this file.
Functions | |
| unsigned int | steer_away_from_object (short obj, short other, short amount) |
| void | steer_away_from_predicted_object (short obj, short other, short predictionTicks, short amount) |
| void | prevent_collision (short obj) |
| short | handle_collisions (short obj) |
| int | regulate_turn (short obj) |
| unsigned int | select_target (short obj) |
| unsigned int | veer_random (short obj, short amount) |
| unsigned int | offset_location (short obj, const ShortVector *offset, FixedVector *location) |
| unsigned int | compute_formation_destination (short leader, const ShortVector *offset, FixedVector *destination) |
| unsigned int | control_speed (short obj, unsigned short range, int desiredSpeed) |
| unsigned int | chase_location (short obj, const FixedVector *destination, short reference) |
| unsigned int | goto_location (short obj, const FixedVector *destination) |
| unsigned int | goto_formation (short obj, const FixedVector *destination, short leader) |
| unsigned int | maintain_formation (short obj) |
| unsigned int | reset_stress (short obj) |
| short | stress_morale (short obj) |
| enum ShipManeuver | any_defense (short obj) |
| enum ShipManeuver | pick_regular_maneuver (short obj, int event) |
| enum ShipManeuver | pick_from_list (const ManeuverChoice *choice, short obj) |
| enum ShipManeuver | pick_kilrathi_maneuver (short obj, int event) |
| unsigned int | process_maneuver_node (short obj, int event) |
| void | handle_stress (short obj, int event) |
| void | intelligence_events (short obj) |
| unsigned int | chase_speed (short obj, short range) |
Variables | |
| FixedVector | aShipRightVector [64] |
| FixedVector | aShipUpVector [64] |
| FixedVector | aShipFwdVec [64] |
| HazardField * | pActiveHazardField |
| signed char | acPlayerComponentDamageList [9] |
| signed char | abFlightPathList [MISSION_OBJECTIVE_COUNT] |
| FixedVector | aShipVelocity [SPACE_OBJECT_COUNT] |
| short | anYawTarget [16] |
Collision avoidance, formation flying and manoeuvre selection.
Address range 433ac0-434ccf. The ordered MacsBug symbols of the Super Wing Commander smart unit corroborate the boundary: its final routine is chase_speed, immediately followed by the random unit.
Definition in file smart.c.
| enum ShipManeuver any_defense | ( | short | obj | ) |
Definition at line 414 of file smart.c.
References aiPilotLevel, any_defense(), apDefenseManeuvers, and RandomBelowOrEqual().
Referenced by any_defense(), pick_kilrathi_maneuver(), pick_regular_maneuver(), and PlaySfxWaveFileByNumber().
| unsigned int chase_location | ( | short | obj, |
| const FixedVector * | destination, | ||
| short | reference ) |
Definition at line 246 of file smart.c.
References AddFixedVectors(), anRollGoal, anShipSpeed, approach_speed(), aShipFwdVec, chase_location(), control_speed(), copy_frame(), FixedToShortSaturating(), get_facing_range_from_point(), match_roll_orientation(), MaxShort(), nFacingToTargetValue, no_goal(), nTgtRange, point_ship(), ScaleFixedVector(), steady_object(), trim_goals(), and vToTgt.
Referenced by chase_location(), Mchill(), and PlaySfxWaveFileByNumber().
| unsigned int chase_speed | ( | short | obj, |
| short | range ) |
Definition at line 672 of file smart.c.
References acShipTargetTable, anShipSpeed, approach_full_speed(), approach_speed(), approach_zero_speed(), chase_speed(), and nTgtRange.
Referenced by chase_speed(), Mtail_fire(), and PlaySfxWaveFileByNumber().
| unsigned int compute_formation_destination | ( | short | leader, |
| const ShortVector * | offset, | ||
| FixedVector * | destination ) |
Definition at line 206 of file smart.c.
References AddFixedVectors(), aShipVelocity, compute_formation_destination(), and offset_location().
Referenced by compute_formation_destination(), maintain_formation(), and PlaySfxWaveFileByNumber().
| unsigned int control_speed | ( | short | obj, |
| unsigned short | range, | ||
| int | desiredSpeed ) |
Definition at line 221 of file smart.c.
References AbsInt(), anShipSpeed, approach_speed(), celerate(), control_speed(), FixedToShortSaturating(), GetShipAccelerationRate(), and MaxShort().
Referenced by chase_location(), control_speed(), goto_formation(), and PlaySfxWaveFileByNumber().
| unsigned int goto_formation | ( | short | obj, |
| const FixedVector * | destination, | ||
| short | leader ) |
Definition at line 323 of file smart.c.
References AddFixedVectors(), anRollGoal, anShipSpeed, approach_full_speed(), approach_min_speed(), approach_ship_speed(), aShipFwdVec, aShipPositionsArray, control_speed(), copy_frame(), fire_afterburner(), get_facing_range_from_point(), goto_formation(), match_roll_orientation(), nFacingToTargetValue, no_goal(), normal_speed(), nTgtRange, point_parallel(), point_ship(), steady_object(), trim_goals(), and vToTgt.
Referenced by goto_formation(), maintain_formation(), and PlaySfxWaveFileByNumber().
| unsigned int goto_location | ( | short | obj, |
| const FixedVector * | destination ) |
Definition at line 297 of file smart.c.
References anShipSpeed, approach_cruise_speed(), approach_full_speed(), approach_half_speed(), FixedToShortSaturating(), goto_location(), MaxShort(), nFacingToTargetValue, no_goal(), nTgtRange, point_ship_at_point(), and ship_vs_point().
Referenced by goto_location(), and PlaySfxWaveFileByNumber().
| short handle_collisions | ( | short | obj | ) |
Definition at line 122 of file smart.c.
References alert_flag(), detect_collisions(), handle_collisions(), prevent_collision(), and start_collision_alert().
Referenced by handle_collisions(), PlaySfxWaveFileByNumber(), and regulate_turn().
| void handle_stress | ( | short | obj, |
| int | event ) |
Definition at line 552 of file smart.c.
References acPilotAggression, acPilotRecovery, acShipStressList, aiPilotLevel, evaluate_damage(), handle_stress(), and MinShort().
Referenced by handle_stress(), intelligence_events(), and PlaySfxWaveFileByNumber().
| void intelligence_events | ( | short | obj | ) |
Definition at line 599 of file smart.c.
References acShipAiCooldowns, acShipStressList, acShipTargetTable, acWingmanMessageStatesArray, aeObjectClass, aeSpecialManeuvers, aiIntelligenceEvent, anShipSpeed, any_enemy(), evaluate_damage(), handle_stress(), intelligence_events(), missile_on_tail(), nFacingToTargetValue, nTargetFacingValue, nTgtRange, nYourWingman, OBJECT_CLASS_SHIP, OBJECTIVE_NONE, process_maneuver_node(), RandomBelow(), reset_objective(), reset_stress(), select_target(), send_message(), ship_vs_ship(), SPECIAL_MANEUVER_UNKNOWN_9, and unactive().
Referenced by intelligence_events(), maneuvering(), and PlaySfxWaveFileByNumber().
| unsigned int maintain_formation | ( | short | obj | ) |
Definition at line 367 of file smart.c.
References aShipDestinationsArray, aShipFormationDeltaList, asShipWingLeaderArray, compute_formation_destination(), goto_formation(), and maintain_formation().
Referenced by imperial_formation(), kilrathi_wingman(), maintain_formation(), PlaySfxWaveFileByNumber(), and run_away().
| unsigned int offset_location | ( | short | obj, |
| const ShortVector * | offset, | ||
| FixedVector * | location ) |
Definition at line 192 of file smart.c.
References aShipFwdVec, aShipPositionsArray, aShipRightVector, aShipUpVector, offset_location(), position_relative(), ShortVector::x, ShortVector::y, and ShortVector::z.
Referenced by compute_formation_destination(), offset_location(), PlaySfxWaveFileByNumber(), and set_formation_position().
| enum ShipManeuver pick_from_list | ( | const ManeuverChoice * | choice, |
| short | obj ) |
Definition at line 481 of file smart.c.
References aeShipManeuversTable, MANEUVER_NONE, MANEUVER_UNKNOWN_45, pick_from_list(), ManeuverChoice::primary, RandomBelow(), RandomBelowOrEqual(), ManeuverChoice::secondary, and ManeuverChoice::threshold.
Referenced by pick_from_list(), pick_kilrathi_maneuver(), PlaySfxWaveFileByNumber(), and process_maneuver_node().
| enum ShipManeuver pick_kilrathi_maneuver | ( | short | obj, |
| int | event ) |
Definition at line 507 of file smart.c.
References aiPilotLevel, aKilrathiManeuverChoices, any_defense(), MANEUVER_STRAFE_ENEMY, MANEUVER_UNKNOWN_45, MANEUVER_UNKNOWN_46, pick_from_list(), pick_kilrathi_maneuver(), and stress_morale().
Referenced by pick_kilrathi_maneuver(), PlaySfxWaveFileByNumber(), and process_maneuver_node().
| enum ShipManeuver pick_regular_maneuver | ( | short | obj, |
| int | event ) |
Definition at line 428 of file smart.c.
References acShipTargetTable, aeObjectClass, aeShipManeuversTable, aiIntelligenceEvent, aiPilotLevel, any_defense(), MANEUVER_DROP_A_MINE, MANEUVER_HARD_TURN, MANEUVER_LINE_UP_DROP, MANEUVER_NONE, MANEUVER_OUTA_HERE, MANEUVER_ROLL_OVER, MANEUVER_STRAFE_ENEMY, MANEUVER_TAIL_FIRE, MANEUVER_TRY2TAIL, MANEUVER_WABBLE, MANEUVER_ZIP_PAST, mine_available(), OBJECT_CLASS_CAPITAL_SHIP, pick_regular_maneuver(), RandomBelow(), RandomBelowOrEqual(), and stress_morale().
Referenced by pick_regular_maneuver(), PlaySfxWaveFileByNumber(), and process_maneuver_node().
| void prevent_collision | ( | short | obj | ) |
Definition at line 77 of file smart.c.
References abCollisionAlertTargets, approach_full_speed(), approach_zero_speed(), aShipPositionsArray, clear_alert(), crash_time(), fire_afterburner(), MaxShort(), MinShort(), nFacingToTargetValue, no_goal(), normal_speed(), nTargetFacingValue, prevent_collision(), ship_vs_point(), steer_away_from_predicted_object(), try2end_collision_alert(), and veer_random().
Referenced by handle_collisions(), PlaySfxWaveFileByNumber(), and prevent_collision().
| unsigned int process_maneuver_node | ( | short | obj, |
| int | event ) |
Definition at line 527 of file smart.c.
References acShipRating, aeShipManeuversTable, aeShipSide, aRatedManeuverChoices, pick_from_list(), pick_kilrathi_maneuver(), pick_regular_maneuver(), process_maneuver_node(), reset_maneuver(), SIDE_KILRATHI, and stress_morale().
Referenced by intelligence_events(), PlaySfxWaveFileByNumber(), and process_maneuver_node().
| int regulate_turn | ( | short | obj | ) |
Definition at line 135 of file smart.c.
References abShipTurnList, acTurnIntervalArray, acTurnRegulatorsArray, aeObjectClass, aeSpecialManeuvers, handle_collisions(), OBJECT_CLASS_CAPITAL_SHIP, regulate_turn(), and SPECIAL_MANEUVER_UNKNOWN_9.
Referenced by capital_ship_intelligence(), PlaySfxWaveFileByNumber(), regulate_turn(), and ship_intelligence().
| unsigned int reset_stress | ( | short | obj | ) |
Definition at line 382 of file smart.c.
References acPilotAggression, acShipStressList, aiPilotLevel, evaluate_damage(), find_ratio(), and reset_stress().
Referenced by intelligence_events(), PlaySfxWaveFileByNumber(), and reset_stress().
| unsigned int select_target | ( | short | obj | ) |
Definition at line 154 of file smart.c.
References acShipTargetTable, aeShipSide, attacker_in_range(), distance_from_object(), RandomBelow(), scan_for_enemy(), select_target(), and SIDE_KILRATHI.
Referenced by capital_ship_intelligence(), check_engage_target(), intelligence_events(), PlaySfxWaveFileByNumber(), and select_target().
| unsigned int steer_away_from_object | ( | short | obj, |
| short | other, | ||
| short | amount ) |
Definition at line 25 of file smart.c.
References AddFixedVectors(), anPitchGoal, anRollGoal, anYawTarget, aShipPositionsArray, aShipVelocity, ComputeVectorDelta(), steer_away_from_object(), transform_to_objects_frame(), FixedVector::x, and FixedVector::y.
Referenced by Mget_distance(), Mveer_away(), PlaySfxWaveFileByNumber(), and steer_away_from_object().
| void steer_away_from_predicted_object | ( | short | obj, |
| short | other, | ||
| short | predictionTicks, | ||
| short | amount ) |
Definition at line 50 of file smart.c.
References AddFixedVectors(), anPitchGoal, anRollGoal, anYawTarget, aShipPositionsArray, aShipVelocity, ComputeVectorDelta(), ScaleFixedVector(), steer_away_from_predicted_object(), transform_to_objects_frame(), FixedVector::x, and FixedVector::y.
Referenced by PlaySfxWaveFileByNumber(), prevent_collision(), and steer_away_from_predicted_object().
| short stress_morale | ( | short | obj | ) |
Definition at line 404 of file smart.c.
References acShipStressList, and stress_morale().
Referenced by pick_kilrathi_maneuver(), pick_regular_maneuver(), PlaySfxWaveFileByNumber(), process_maneuver_node(), and stress_morale().
| unsigned int veer_random | ( | short | obj, |
| short | amount ) |
Definition at line 172 of file smart.c.
References anPitchGoal, anYawTarget, RandomBelowOrEqual(), and veer_random().
Referenced by Mbuzz_debris(), Msit_n_spin(), Mtry2tail(), Mturn_n_kick(), Mturn_n_spin(), Mveer_away(), PlaySfxWaveFileByNumber(), prevent_collision(), ShipAiState35(), streak_toward(), and veer_random().
| signed char abFlightPathList[MISSION_OBJECTIVE_COUNT] |
Definition at line 20 of file smart.c.
Referenced by arrive_from_warp(), auto_pilot_sequence(), Build_objective_list(), CentreMouseOnCurrentNavObjective(), cruise_home(), cruise_to_destination(), cycle_next_objective(), get_follow_point(), SelectNavObjectiveAtPoint(), set_new_objective(), set_next_destination(), and triumph().
| signed char acPlayerComponentDamageList[9] |
Definition at line 19 of file smart.c.
Referenced by damage_your_component(), HandleSpaceFlightControls(), malf(), prepare_mission(), repair_internal_damage(), replenish_shields(), replenish_weapon_energy_bank(), ReportComponentRepaired(), RunTrainSim(), show_damage_disp(), target_locking(), UpdateDamageDisplay(), and your_internal_damage().
| short anYawTarget[16] |
Definition at line 22 of file smart.c.
Referenced by advance_canned_sequence(), auto_pilot_sequence(), formation_break(), general_zig(), Mburnout(), Mcorkscrew(), Mfish_hook(), Mhard_turn(), Msplit_left(), Msplit_right(), Mstrafe_enemy(), Mwabble(), no_goal(), point_perpendicular_to_point(), point_ship(), prepare_for_jump(), rotate_object_to_goal(), steady_object(), steer_away_from_object(), steer_away_from_predicted_object(), tanker_intelligence(), trim_goals(), update_canned_sequence(), and veer_random().
| FixedVector aShipFwdVec[64] |
Definition at line 17 of file smart.c.
Referenced by accelerate_and_move_object(), alter_pitch(), alter_yaw(), animate_object(), approach(), auto_pilot_sequence(), chase_location(), copy_frame(), CreateCannedSceneObject(), ejection_sequence(), facing_to_object(), fire_weapon(), fix_objects_ijk(), fix_velocity(), generate_stars(), get_facing_range_from_object(), get_facing_range_from_point(), get_front_spot(), get_rear_spot(), goto_formation(), HandleFleetOverviewInput(), house_keep_objects(), inflict_damage(), init_hazard(), init_ijk(), InitializeConstellationObject(), make_shard(), match_ship_to_eye(), Msit_n_spin(), new_view(), offset_location(), parse_view_script(), point_at(), point_parallel(), point_ship_behind_object(), position_child(), position_relative_ijk(), set_eye_direction_and_position(), SetFleetOverviewView(), ShowGameOverScreen(), ShowTigerClawEscapeScene(), skew_randomly(), start_dust(), Title_Sequence(), transform_to_objects_frame(), try_far_spot(), and update_star_field().
| FixedVector aShipRightVector[64] |
Definition at line 15 of file smart.c.
Referenced by alter_roll(), alter_yaw(), copy_frame(), ejection_sequence(), fix_objects_ijk(), generate_stars(), HandleFleetOverviewInput(), inflict_damage(), init_ijk(), match_roll_orientation(), match_ship_to_eye(), new_view(), offset_location(), position_child(), position_relative_ijk(), set_background_objects_rotation(), set_eye_direction_and_position(), SetFleetOverviewView(), skew_randomly(), start_dust(), transform_to_objects_frame(), try_far_spot(), and update_star_field().
| FixedVector aShipUpVector[64] |
Definition at line 16 of file smart.c.
Referenced by alter_pitch(), alter_roll(), copy_frame(), ejection_sequence(), fire_weapon(), fix_objects_ijk(), generate_stars(), get_right_shape(), HandleFleetOverviewInput(), init_ijk(), match_roll_orientation(), match_ship_to_eye(), new_view(), offset_location(), point_ship_below_object(), position_child(), position_relative_ijk(), set_background_objects_rotation(), set_eye_direction_and_position(), SetFleetOverviewView(), ShowGameOverScreen(), skew_randomly(), start_dust(), transform_to_objects_frame(), try_far_spot(), and update_star_field().
| FixedVector aShipVelocity[SPACE_OBJECT_COUNT] |
Definition at line 21 of file smart.c.
Referenced by accelerate_and_move_object(), animate_object(), apply_force_to_object(), apply_force_to_objects_center(), approach(), auto_pilot_sequence(), compute_formation_destination(), Create_explosion_debris(), Create_ship_hit_debris(), cruise_home(), ejection_sequence(), fire(), fire_afterburner(), fire_weapon(), fix_velocity(), hit_asteroid(), house_keep_objects(), init_hazard(), initialize_object(), initialize_scripted_view(), launch_object(), make_shard(), match_ship_to_eye(), new_view(), object_collision(), onboard_explosion(), parse_view_script(), real_crash_time(), real_velocity(), send_at_point(), servicetrack(), set_eye_direction_and_position(), Set_up_ship_info(), SetFleetOverviewView(), ShipExplosion(), ShowCarrierLaunchSequence(), ShowGameOverScreen(), ShowTigerClawEscapeScene(), start_dust(), steer_away_from_object(), steer_away_from_predicted_object(), Title_Sequence(), unwarp(), update_canned_sequence(), update_digital_readouts(), update_star_field(), and warp().
| HazardField* pActiveHazardField |
Definition at line 18 of file smart.c.
Referenced by auto_pilot_sequence(), auto_pilot_valid(), check_hazards(), init_hazard(), match_ship_to_eye(), remove_all_hazards(), start_hazard_field(), try_far_spot(), and update_star_field().