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

Ship AI bookkeeping: alerts, collisions, goals and squads. More...

#include "game.h"

Go to the source code of this file.

Macros

#define LOGIC_C

Functions

void SendKilrathiAceGreetingOnce (short obj)
short signed_random (short range)
short alert_flag (short ship, unsigned int bits)
void set_alert (short i, unsigned int bits)
void clear_alert (short i)
void start_collision_alert (short obj, short other)
void try2end_collision_alert (short obj)
short normal_speed (short obj)
short real_crash_time (short obj, short other)
short crash_time (short obj, short other)
short detect_collisions (short obj)
short unactive (short ship)
short are_alive (short obj)
void trim_goals (short obj, short amount)
short report_kilrathi_rout (int mode)
short find_ship_index (short missionShip)
short try2rout (short obj)
signed char CanSetNewShipTurnGoal (short ship)
signed char no_goal (short ship)
short being_tailed (short obj, short other)
short detect_enemy_tail (short obj)
short is_ship_tailing_player_target (short obj)
short FindMissileTargetingObject (short obj)
void build_squad_list (short leader)
unsigned int find_squad_center (FixedVector *center)
void init_formation_burst (short obj)
void reset_mission_type (short obj, short missionType)
unsigned int change_mission_type (short obj, short missionType)
unsigned int reset_objective (short ship, short objective)
unsigned int alter_objective (short ship, short objective)
unsigned int reset_tactic (short ship, short tactic)
unsigned int alter_tactic (short ship, short tactic)
void reset_maneuver (short ship, short maneuver)
void try2reset_maneuver (short obj, short maneuver)
void set_special (short ship, short special)
unsigned int approach_zero_speed (short ship)
unsigned int approach_min_speed (short obj)
void approach_half_speed (short obj)
unsigned int approach_cruise_speed (short ship)
unsigned int approach_full_speed (short ship)
unsigned int approach_ship_speed (short obj, short other)
void ComputePointAheadOfObject (short obj, unsigned short distance, FixedVector *point)
void ComputePointBehindObject (short obj, unsigned short distance, FixedVector *point)
short close_behind (short range)
short scan_for_enemy (short obj, unsigned short range)
short distance_from_object (short obj, short other)
short any_enemy (short obj, short range)
short ships_within_range (short obj, short other, short range)
short enemy_within_range (short obj, short range)
short attacker_in_range (short obj, unsigned short range)
short in_danger (short obj)
short target_within_range (short obj)
short target_valid (short obj, short target)
short build_target_list (short obj, short range)
void inherit_leader_mission (short obj)
void inherit_leader (short obj)
short dead_ship (short i)
short gone_ship (short missionShip)
short skill_check (short obj, short margin)
short find_ships_sphere (short missionShip)
short locate_ship (short missionShip, FixedVector *point)
void get_follow_point (short obj, FixedVector *point)
unsigned int get_first_follow_point (short obj, FixedVector *point)
short hostile_sphere (short obj, short navPoint)
short abandoned (short obj, short other)
void engage (short obj, short target, short objective)
short ShipHasTorpedo (short ship)
short CanShipWeaponDamageTarget (short ship, short target)
short triumph (short obj)
short find_ratio (short inputMinimum, short inputMaximum, short input, short outputMinimum, short outputMaximum)
short evaluate_damage (short obj)

Variables

short g_bKilrathiAceGreetingSent = 0
short g_5_nCollisionCountdownNumber
signed char g_acMissionShipStatusFlagsBytes [8]
short g_bWingmanKilledThisMission
signed char g_4_acInitialShipKillNumber [8]
short g_nLastFoundShip

Detailed Description

Ship AI bookkeeping: alerts, collisions, goals and squads.

Definition in file logic.c.

Macro Definition Documentation

◆ LOGIC_C

#define LOGIC_C

Definition at line 6 of file logic.c.

Function Documentation

◆ abandoned()

◆ alert_flag()

short alert_flag ( short ship,
unsigned int bits )

◆ alter_objective()

unsigned int alter_objective ( short ship,
short objective )

◆ alter_tactic()

unsigned int alter_tactic ( short ship,
short tactic )

◆ any_enemy()

◆ approach_cruise_speed()

◆ approach_full_speed()

◆ approach_half_speed()

◆ approach_min_speed()

unsigned int approach_min_speed ( short obj)

Definition at line 514 of file logic.c.

References approach_min_speed(), and approach_speed().

Referenced by approach_min_speed(), DrawTextAt(), and goto_formation().

◆ approach_ship_speed()

unsigned int approach_ship_speed ( short obj,
short other )

◆ approach_zero_speed()

◆ are_alive()

short are_alive ( short obj)

Definition at line 194 of file logic.c.

References are_alive(), g_aeShipObjective, SHIP_OBJECTIVE_NOT_ALIVE, and unactive().

Referenced by are_alive(), and DrawTextAt().

◆ attacker_in_range()

◆ being_tailed()

short being_tailed ( short obj,
short other )

◆ build_squad_list()

void build_squad_list ( short leader)

Definition at line 370 of file logic.c.

References build_squad_list(), g_acShipList, and g_asShipWingLeader.

Referenced by build_squad_list(), DrawTextAt(), and init_formation_burst().

◆ build_target_list()

◆ CanSetNewShipTurnGoal()

◆ CanShipWeaponDamageTarget()

short CanShipWeaponDamageTarget ( short ship,
short target )

Definition at line 87 of file ship.c.

◆ change_mission_type()

unsigned int change_mission_type ( short obj,
short missionType )

◆ clear_alert()

◆ close_behind()

short close_behind ( short range)

Definition at line 568 of file logic.c.

References close_behind(), g_nTargetFacing, and g_nTargetRange.

◆ ComputePointAheadOfObject()

void ComputePointAheadOfObject ( short obj,
unsigned short distance,
FixedVector * point )

◆ ComputePointBehindObject()

void ComputePointBehindObject ( short obj,
unsigned short distance,
FixedVector * point )

◆ crash_time()

short crash_time ( short obj,
short other )

◆ dead_ship()

short dead_ship ( short i)

Definition at line 792 of file logic.c.

References dead_ship(), g_aMissionShips, and MissionShipRecord::state.

Referenced by close_behind(), dead_ship(), locate_ship(), and triumph().

◆ detect_collisions()

◆ detect_enemy_tail()

◆ distance_from_object()

short distance_from_object ( short obj,
short other )

Definition at line 547 of file geom.c.

◆ enemy_within_range()

short enemy_within_range ( short obj,
short range )

◆ engage()

◆ evaluate_damage()

◆ find_ratio()

short find_ratio ( short inputMinimum,
short inputMaximum,
short input,
short outputMinimum,
short outputMaximum )

◆ find_ship_index()

◆ find_ships_sphere()

◆ find_squad_center()

unsigned int find_squad_center ( FixedVector * center)

◆ FindMissileTargetingObject()

◆ get_first_follow_point()

unsigned int get_first_follow_point ( short obj,
FixedVector * point )

◆ get_follow_point()

◆ gone_ship()

short gone_ship ( short missionShip)

◆ hostile_sphere()

short hostile_sphere ( short obj,
short navPoint )

◆ in_danger()

◆ inherit_leader()

void inherit_leader ( short obj)

◆ inherit_leader_mission()

◆ init_formation_burst()

◆ is_ship_tailing_player_target()

short is_ship_tailing_player_target ( short obj)

◆ locate_ship()

◆ no_goal()

◆ normal_speed()

◆ real_crash_time()

◆ report_kilrathi_rout()

◆ reset_maneuver()

◆ reset_mission_type()

◆ reset_objective()

◆ reset_tactic()

◆ scan_for_enemy()

◆ SendKilrathiAceGreetingOnce()

void SendKilrathiAceGreetingOnce ( short obj)

◆ set_alert()

void set_alert ( short i,
unsigned int bits )

Definition at line 31 of file logic.c.

References g_anShipAlertFlags, and set_alert().

Referenced by DrawTextAt(), set_alert(), start_collision_alert(), and try2end_collision_alert().

◆ set_special()

◆ ShipHasTorpedo()

short ShipHasTorpedo ( short ship)

Definition at line 122 of file ship.c.

◆ ships_within_range()

short ships_within_range ( short obj,
short other,
short range )

◆ signed_random()

short signed_random ( short range)

◆ skill_check()

short skill_check ( short obj,
short margin )

◆ start_collision_alert()

◆ target_valid()

◆ target_within_range()

short target_within_range ( short obj)

◆ trim_goals()

void trim_goals ( short obj,
short amount )

◆ triumph()

◆ try2end_collision_alert()

void try2end_collision_alert ( short obj)

◆ try2reset_maneuver()

void try2reset_maneuver ( short obj,
short maneuver )

Definition at line 484 of file logic.c.

References g_asShipManeuver, reset_maneuver(), steady_object(), and try2reset_maneuver().

Referenced by DrawTextAt(), and try2reset_maneuver().

◆ try2rout()

◆ unactive()

Variable Documentation

◆ g_4_acInitialShipKillNumber

signed char g_4_acInitialShipKillNumber[8]

◆ g_5_nCollisionCountdownNumber

short g_5_nCollisionCountdownNumber

Definition at line 1053 of file logic.c.

Referenced by detect_collisions(), and prevent_collision().

◆ g_acMissionShipStatusFlagsBytes

signed char g_acMissionShipStatusFlagsBytes[8]

◆ g_bKilrathiAceGreetingSent

short g_bKilrathiAceGreetingSent = 0

Definition at line 1049 of file logic.c.

Referenced by SendKilrathiAceGreetingOnce(), and Set_up_ship_info().

◆ g_bWingmanKilledThisMission

short g_bWingmanKilledThisMission

Definition at line 1055 of file logic.c.

Referenced by prepare_mission().

◆ g_nLastFoundShip

short g_nLastFoundShip

Definition at line 1057 of file logic.c.

Referenced by find_ship_index().