Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
smart.c File Reference

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]

Detailed Description

Pilot steering, formation flying and maneuver selection.

Definition in file smart.c.

Function Documentation

◆ any_defense()

short any_defense ( short obj)

◆ attacker_in_range()

short attacker_in_range ( short obj,
unsigned short range )

Definition at line 664 of file logic.c.

◆ chase_location()

◆ compute_formation_destination()

unsigned int compute_formation_destination ( short leader,
const ShortVector * offset,
FixedVector * destination )

◆ ComputeVectorDelta()

void ComputeVectorDelta ( FixedVector * from,
FixedVector * to,
FixedVector * delta )

Definition at line 229 of file geom.c.

◆ control_speed()

void control_speed ( short obj,
unsigned short range,
int desiredSpeed )

◆ CountAlliesOnSameTarget()

short CountAlliesOnSameTarget ( short obj)

◆ CountEnemyFighters()

short CountEnemyFighters ( void )

◆ goto_formation()

◆ goto_location()

◆ handle_collisions()

◆ handle_stress()

void handle_stress ( short obj,
short event )

◆ intelligence_events()

◆ maintain_formation()

unsigned int maintain_formation ( short obj)

◆ offset_location()

◆ pick_from_list()

◆ pick_kilrathi_maneuver()

◆ pick_regular_maneuver()

◆ position_relative()

void position_relative ( FixedVector * position,
FixedVector direction,
short distance )

Definition at line 101 of file geom.c.

◆ prevent_collision()

◆ process_maneuver_node()

◆ RandomBelow()

short RandomBelow ( short n)

Definition at line 12 of file eventmgr.c.

◆ regulate_turn()

◆ reset_objective()

unsigned int reset_objective ( short ship,
short objective )

Definition at line 445 of file logic.c.

◆ reset_stress()

unsigned int reset_stress ( short obj)

◆ scan_for_enemy()

short scan_for_enemy ( short obj,
unsigned short range )

Definition at line 576 of file logic.c.

◆ select_target()

◆ steer_away_from_object()

◆ steer_away_from_predicted_object()

◆ stress_morale()

short stress_morale ( short obj)

◆ transform_to_objects_frame()

void transform_to_objects_frame ( const FixedVector * source,
FixedVector * destination,
short obj )

Definition at line 495 of file geom.c.

◆ try2end_collision_alert()

void try2end_collision_alert ( short obj)

Definition at line 58 of file logic.c.

◆ veer_random()

unsigned int veer_random ( short obj,
short amount )

Variable Documentation

◆ g_acPilotAggression

signed char g_acPilotAggression[8]
Initial value:
= {
3, 3, 3, 2, 2, 3, 0, 0
}

Definition at line 30 of file smart.c.

Referenced by handle_stress(), and reset_stress().

◆ g_acPilotRecovery

signed char g_acPilotRecovery[8]
Initial value:
= {
6, 7, 8, 8, 9, 8, 0, 0
}

Definition at line 33 of file smart.c.

Referenced by handle_stress().

◆ g_aDefenseManeuversAce

signed char g_aDefenseManeuversAce[16]
Initial value:
= {
17, 23, 15, 19, 9, 14, 20, 12, -1, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 17 of file smart.c.

◆ g_aDefenseManeuversBoss

signed char g_aDefenseManeuversBoss[16]
Initial value:
= {
15, 19, 12, 11, 17, 23, 7, 9, -1, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 20 of file smart.c.

◆ g_aDefenseManeuversElite

signed char g_aDefenseManeuversElite[16]
Initial value:
= {
8, 15, 17, 23, 19, 9, 20, 24, 14, -1, 0, 0, 0, 0, 0, 0
}

Definition at line 14 of file smart.c.

◆ g_aDefenseManeuversNovice

signed char g_aDefenseManeuversNovice[8]
Initial value:
= {
24, 24, 13, 14, -1, 0, 0, 0
}

Definition at line 8 of file smart.c.

◆ g_aDefenseManeuversVeteran

signed char g_aDefenseManeuversVeteran[8]
Initial value:
= {
8, 13, 15, 14, 19, 24, -1, 0
}

Definition at line 11 of file smart.c.

◆ g_apDefenseManeuvers

signed char* g_apDefenseManeuvers[5]
Initial value:
= {
}
signed char g_aDefenseManeuversElite[16]
Definition smart.c:14
signed char g_aDefenseManeuversAce[16]
Definition smart.c:17
signed char g_aDefenseManeuversBoss[16]
Definition smart.c:20
signed char g_aDefenseManeuversVeteran[8]
Definition smart.c:11
signed char g_aDefenseManeuversNovice[8]
Definition smart.c:8

Definition at line 23 of file smart.c.

Referenced by any_defense().

◆ g_aShipIntelligenceData

unsigned char g_aShipIntelligenceData[5][0x51]

◆ g_bWingmanTurnRateUnlocked

short g_bWingmanTurnRateUnlocked = 0

Definition at line 36 of file smart.c.

Referenced by process_maneuver_node(), and regulate_turn().