|
Wing Commander II
Reconstructed Win32 source (1996)
|
Pilot steering, formation flying and maneuver selection. More...
#include "game.h"Go to the source code of this file.
Functions | |
| void | steer_away_from_object (short obj, short other, short amount) |
| void | transform_to_objects_frame (const FixedVector *source, FixedVector *destination, short obj) |
| void | ComputeVectorDelta (FixedVector *from, FixedVector *to, FixedVector *delta) |
| void | try2end_collision_alert (short obj) |
| 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 | select_target (short obj) |
| void | steer_away_from_predicted_object (short obj, short other, short predictionTicks, short amount) |
| void | prevent_collision (short obj) |
| short | handle_collisions (short obj) |
| short | CountEnemyFighters (void) |
| void | position_relative (FixedVector *position, FixedVector direction, short distance) |
| short | scan_for_enemy (short obj, unsigned short range) |
| short | attacker_in_range (short obj, unsigned short range) |
| short | regulate_turn (short obj) |
| unsigned int | veer_random (short obj, short amount) |
| void | control_speed (short obj, unsigned short range, int desiredSpeed) |
| void | chase_location (short obj, const FixedVector *destination, short reference) |
| void | goto_location (short obj, const FixedVector *destination) |
| void | 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) |
| short | any_defense (short obj) |
| short | pick_regular_maneuver (short obj, short event) |
| short | RandomBelow (short n) |
| short | pick_from_list (const ManeuverChoice *choice, short obj, short event) |
| short | pick_kilrathi_maneuver (short obj, short event) |
| short | CountAlliesOnSameTarget (short obj) |
| void | process_maneuver_node (short obj, short event) |
| void | handle_stress (short obj, short event) |
| unsigned int | reset_objective (short ship, short objective) |
| void | intelligence_events (short obj) |
Variables | |
| signed char | g_aDefenseManeuversNovice [8] |
| signed char | g_aDefenseManeuversVeteran [8] |
| signed char | g_aDefenseManeuversElite [16] |
| signed char | g_aDefenseManeuversAce [16] |
| signed char | g_aDefenseManeuversBoss [16] |
| signed char * | g_apDefenseManeuvers [5] |
| signed char | g_acPilotAggression [8] |
| signed char | g_acPilotRecovery [8] |
| short | g_bWingmanTurnRateUnlocked = 0 |
| unsigned char | g_aShipIntelligenceData [5][0x51] |
Pilot steering, formation flying and maneuver selection.
Definition in file smart.c.
| short any_defense | ( | short | obj | ) |
Definition at line 438 of file smart.c.
References any_defense(), g_apDefenseManeuvers, g_asPilotLevel, and RandomBelowOrEqual().
Referenced by any_defense(), maintain_formation(), pick_kilrathi_maneuver(), and pick_regular_maneuver().
| void chase_location | ( | short | obj, |
| const FixedVector * | destination, | ||
| short | reference ) |
Definition at line 278 of file smart.c.
References AddFixedVectors(), approach_speed(), CanSetNewShipTurnGoal(), chase_location(), control_speed(), copy_frame(), FixedToShortSaturating(), g_anRollGoal, g_anShipSpeed, g_aShipForwardVector, g_nFacingToTarget, g_nTargetRange, g_vToTarget, get_facing_range_from_point(), match_roll_orientation(), MaxShort(), point_ship(), ScaleFixedVector(), steady_object(), and trim_goals().
Referenced by chase_location(), and UpdateShipTurretGuns().
| unsigned int compute_formation_destination | ( | short | leader, |
| const ShortVector * | offset, | ||
| FixedVector * | destination ) |
Definition at line 243 of file smart.c.
References AddFixedVectors(), compute_formation_destination(), g_aShipVelocity, and offset_location().
Referenced by compute_formation_destination(), maintain_formation(), and UpdateShipTurretGuns().
| void ComputeVectorDelta | ( | FixedVector * | from, |
| FixedVector * | to, | ||
| FixedVector * | delta ) |
| void control_speed | ( | short | obj, |
| unsigned short | range, | ||
| int | desiredSpeed ) |
Definition at line 257 of file smart.c.
References AbsInt(), approach_speed(), celerate(), control_speed(), FixedToShortSaturating(), g_anShipSpeed, GetShipAccelerationRate(), and MaxShort().
Referenced by chase_location(), control_speed(), goto_formation(), and UpdateShipTurretGuns().
| short CountAlliesOnSameTarget | ( | short | obj | ) |
Definition at line 563 of file smart.c.
References CountAlliesOnSameTarget(), g_acShipTarget, g_aeObjectClass, g_asIntelligenceEvent, g_asShipSide, and OBJECT_CLASS_SHIP.
Referenced by CountAlliesOnSameTarget(), maintain_formation(), and process_maneuver_node().
| short CountEnemyFighters | ( | void | ) |
Definition at line 154 of file smart.c.
References CountEnemyFighters(), g_aeObjectClass, g_asShipSide, and OBJECT_CLASS_SHIP.
Referenced by CountEnemyFighters(), regulate_turn(), and UpdateShipTurretGuns().
| void goto_formation | ( | short | obj, |
| const FixedVector * | destination, | ||
| short | leader ) |
Definition at line 348 of file smart.c.
References AddFixedVectors(), approach_full_speed(), approach_min_speed(), approach_ship_speed(), CanSetNewShipTurnGoal(), control_speed(), copy_frame(), fire_afterburner(), g_anRollGoal, g_anShipSpeed, g_aShipForwardVector, g_aShipPosition, g_nFacingToTarget, g_nTargetRange, g_vToTarget, get_facing_range_from_point(), goto_formation(), match_roll_orientation(), normal_speed(), point_parallel(), point_ship(), steady_object(), and trim_goals().
Referenced by goto_formation(), maintain_formation(), and UpdateShipTurretGuns().
| void goto_location | ( | short | obj, |
| const FixedVector * | destination ) |
Definition at line 329 of file smart.c.
References approach_cruise_speed(), approach_full_speed(), approach_half_speed(), CanSetNewShipTurnGoal(), FixedToShortSaturating(), g_anShipSpeed, g_nFacingToTarget, g_nTargetRange, get_facing_range_from_point(), goto_location(), MaxShort(), and point_ship_at_point().
Referenced by goto_location(), and UpdateShipTurretGuns().
| short handle_collisions | ( | short | obj | ) |
Definition at line 141 of file smart.c.
References alert_flag(), detect_collisions(), handle_collisions(), prevent_collision(), and start_collision_alert().
Referenced by handle_collisions(), regulate_turn(), UpdateSavedTorpedoTargetLock(), and UpdateShipTurretGuns().
| void handle_stress | ( | short | obj, |
| short | event ) |
Definition at line 654 of file smart.c.
References evaluate_damage(), g_acPilotAggression, g_acPilotRecovery, g_acShipStress, g_asPilotLevel, handle_stress(), and MinShort().
Referenced by handle_stress(), intelligence_events(), and maintain_formation().
| void intelligence_events | ( | short | obj | ) |
Definition at line 708 of file smart.c.
References any_enemy(), evaluate_damage(), FindMissileTargetingObject(), g_acShipCollisionCooldown, g_acShipPendingMessage, g_acShipStress, g_acShipTarget, g_aeObjectClass, g_aeSpecialManeuver, g_anShipSpeed, g_asIntelligenceEvent, g_asObjectDamage, g_asShipSide, g_nFacingToTarget, g_nTargetFacing, g_nTargetRange, g_nYourWingman, get_facing_range_from_object(), GetAdaptiveTurnRate(), handle_stress(), intelligence_events(), OBJECT_CLASS_SHIP, OBJECTIVE_NONE, process_maneuver_node(), RandomBelow(), RandomBelowOrEqual(), reset_objective(), reset_stress(), select_target(), send_message(), SIDE_KILRATHI, SPECIAL_MANEUVER_UNKNOWN_9, and unactive().
| unsigned int maintain_formation | ( | short | obj | ) |
Definition at line 391 of file smart.c.
References compute_formation_destination(), g_aShipDestination, g_aShipFormationOffset, g_asShipWingLeader, goto_formation(), and maintain_formation().
| unsigned int offset_location | ( | short | obj, |
| const ShortVector * | offset, | ||
| FixedVector * | location ) |
Definition at line 230 of file smart.c.
References g_aShipForwardVector, g_aShipPosition, g_aShipRightVector, g_aShipUpVector, offset_location(), position_relative(), ShortVector::x, ShortVector::y, and ShortVector::z.
Referenced by compute_formation_destination(), offset_location(), set_formation_position(), and UpdateShipTurretGuns().
| short pick_from_list | ( | const ManeuverChoice * | choice, |
| short | obj, | ||
| short | event ) |
Definition at line 506 of file smart.c.
References g_asIntelligenceEvent, g_asShipManeuver, MANEUVER_NONE, MANEUVER_UNKNOWN_48, pick_from_list(), ManeuverChoice::primary, RandomBelow(), RandomBelowOrEqual(), ManeuverChoice::secondary, and ManeuverChoice::threshold.
Referenced by maintain_formation(), pick_from_list(), pick_kilrathi_maneuver(), and process_maneuver_node().
| short pick_kilrathi_maneuver | ( | short | obj, |
| short | event ) |
Definition at line 538 of file smart.c.
References any_defense(), g_aShipIntelligenceData, g_asShipIntelSlot, MANEUVER_STRAFE_ENEMY, MANEUVER_UNKNOWN_48, MANEUVER_UNKNOWN_49, MANEUVER_ZIP_PAST, pick_from_list(), pick_kilrathi_maneuver(), and stress_morale().
Referenced by maintain_formation(), pick_kilrathi_maneuver(), and process_maneuver_node().
| short pick_regular_maneuver | ( | short | obj, |
| short | event ) |
Definition at line 455 of file smart.c.
References any_defense(), g_acShipTarget, g_aeObjectClass, g_asIntelligenceEvent, g_asPilotLevel, g_asShipManeuver, 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, OBJECT_CLASS_CAPITAL_SHIP, pick_regular_maneuver(), RandomBelow(), RandomBelowOrEqual(), and stress_morale().
Referenced by maintain_formation(), pick_regular_maneuver(), and process_maneuver_node().
| void position_relative | ( | FixedVector * | position, |
| FixedVector | direction, | ||
| short | distance ) |
| void prevent_collision | ( | short | obj | ) |
Definition at line 99 of file smart.c.
References approach_full_speed(), approach_zero_speed(), CanSetNewShipTurnGoal(), clear_alert(), fire_afterburner(), g_5_nCollisionCountdownNumber, g_acShipAlertSource, g_aShipPosition, g_nFacingToTarget, g_nTargetFacing, get_facing_range_from_point(), MaxShort(), MinShort(), normal_speed(), prevent_collision(), steer_away_from_predicted_object(), try2end_collision_alert(), and veer_random().
Referenced by handle_collisions(), prevent_collision(), and UpdateShipTurretGuns().
| void process_maneuver_node | ( | short | obj, |
| short | event ) |
Definition at line 580 of file smart.c.
References CountAlliesOnSameTarget(), fire(), fire_afterburner(), g_13_stMissionHeaderBlock, g_36_cPilotKillCountValue, g_4_acInitialShipKillNumber, g_acShipTarget, g_aeSpecialManeuver, g_anShipCloakState, g_aShipIntelligenceData, g_asPilotLevel, g_asProjectileEvasionTicks, g_asShipCloakCooldown, g_asShipIntelSlot, g_asShipManeuver, g_asShipMissionIndex, g_asShipSide, g_bWingmanTurnRateUnlocked, g_nFacingToTarget, g_nTargetFacing, g_nTargetRange, g_nYourWingman, GetAdaptiveTurnRate(), MissionHeader::initialMissionShips, pick_from_list(), pick_kilrathi_maneuver(), pick_regular_maneuver(), process_maneuver_node(), reset_maneuver(), and stress_morale().
Referenced by intelligence_events(), maintain_formation(), and process_maneuver_node().
| short RandomBelow | ( | short | n | ) |
Definition at line 12 of file eventmgr.c.
| short regulate_turn | ( | short | obj | ) |
Definition at line 173 of file smart.c.
References CountEnemyFighters(), g_abShipTurn, g_acTurnInterval, g_acTurnRegulator, g_aeObjectClass, g_aeSpecialManeuver, g_asShipSide, g_bWingmanTurnRateUnlocked, g_nSpaceFrame, g_nYourWingman, GetAdaptiveTurnRate(), handle_collisions(), OBJECT_CLASS_CAPITAL_SHIP, OBJECT_CLASS_SHIP, regulate_turn(), and SPECIAL_MANEUVER_UNKNOWN_9.
Referenced by capital_ship_intelligence(), regulate_turn(), ship_intelligence(), and UpdateShipTurretGuns().
| unsigned int reset_objective | ( | short | ship, |
| short | objective ) |
| unsigned int reset_stress | ( | short | obj | ) |
Definition at line 405 of file smart.c.
References evaluate_damage(), find_ratio(), g_acPilotAggression, g_acShipStress, g_asPilotLevel, and reset_stress().
Referenced by intelligence_events(), maintain_formation(), and reset_stress().
| unsigned int select_target | ( | short | obj | ) |
Definition at line 199 of file smart.c.
References attacker_in_range(), distance_from_object(), g_acShipTarget, g_asShipSide, RandomBelow(), scan_for_enemy(), select_target(), and SIDE_KILRATHI.
Referenced by capital_ship_intelligence(), check_engage_target(), intelligence_events(), select_target(), and UpdateShipTurretGuns().
| void steer_away_from_object | ( | short | obj, |
| short | other, | ||
| short | amount ) |
Definition at line 40 of file smart.c.
References AddFixedVectors(), ComputeVectorDelta(), g_anPitchGoal, g_anRollGoal, g_anYawGoal, g_aShipPosition, g_aShipVelocity, steer_away_from_object(), transform_to_objects_frame(), FixedVector::x, and FixedVector::y.
Referenced by Mget_distance(), Mveer_away(), steer_away_from_object(), and UpdateShipTurretGuns().
| void steer_away_from_predicted_object | ( | short | obj, |
| short | other, | ||
| short | predictionTicks, | ||
| short | amount ) |
Definition at line 72 of file smart.c.
References AddFixedVectors(), ComputeVectorDelta(), g_anPitchGoal, g_anRollGoal, g_anYawGoal, g_aShipPosition, g_aShipVelocity, ScaleFixedVector(), steer_away_from_predicted_object(), transform_to_objects_frame(), FixedVector::x, and FixedVector::y.
Referenced by prevent_collision(), steer_away_from_predicted_object(), and UpdateShipTurretGuns().
| short stress_morale | ( | short | obj | ) |
Definition at line 427 of file smart.c.
References g_acShipStress, and stress_morale().
Referenced by maintain_formation(), pick_kilrathi_maneuver(), pick_regular_maneuver(), process_maneuver_node(), and stress_morale().
| void transform_to_objects_frame | ( | const FixedVector * | source, |
| FixedVector * | destination, | ||
| short | obj ) |
| unsigned int veer_random | ( | short | obj, |
| short | amount ) |
Definition at line 211 of file smart.c.
References g_anPitchGoal, g_anYawGoal, RandomBelowOrEqual(), and veer_random().
Referenced by Mbuzz_debris(), Msit_n_spin(), Mturn_n_kick(), Mturn_n_spin(), Mveer_away(), prevent_collision(), streak_toward(), UpdateShipTurretGuns(), and veer_random().
| signed char g_acPilotAggression[8] |
Definition at line 30 of file smart.c.
Referenced by handle_stress(), and reset_stress().
| signed char g_acPilotRecovery[8] |
Definition at line 33 of file smart.c.
Referenced by handle_stress().
| signed char g_aDefenseManeuversAce[16] |
| signed char g_aDefenseManeuversBoss[16] |
| signed char g_aDefenseManeuversElite[16] |
| signed char g_aDefenseManeuversNovice[8] |
| signed char g_aDefenseManeuversVeteran[8] |
| signed char* g_apDefenseManeuvers[5] |
| unsigned char g_aShipIntelligenceData[5][0x51] |
Definition at line 796 of file smart.c.
Referenced by init_intelligence_data(), pick_kilrathi_maneuver(), process_maneuver_node(), and ProcessMissionWaveCommands().
| short g_bWingmanTurnRateUnlocked = 0 |
Definition at line 36 of file smart.c.
Referenced by process_maneuver_node(), and regulate_turn().