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

Ships: damage, explosions and weapons. More...

#include "wc1.h"
#include <sys/stat.h>
#include <setjmp.h>

Go to the source code of this file.

Functions

short initialize_object (short obj, enum ObjectType type, short owner)
short borrow_dust (void)
short new_object (enum ObjectType type, short owner)
short initialize_ship (enum ObjectType type, short owner)
short any_selected (signed char *loadout, enum ObjectClass objectClass)
unsigned int remove_weapon (short obj, short weapon)
void set_objects_data (short obj, enum ObjectType type, short owner)
unsigned int match_rotation_goal (short *rotation, short *goal, short totalError, short rate)
int rotate_object_to_goal (short obj)
unsigned int check_for_lost_control (short obj)
unsigned int celerate (short ship, int delta)
unsigned int approach_speed (short ship, int targetSpeed)
unsigned int steady_object (short ship)
short real_velocity (short obj)
unsigned int fix_velocity (short obj)
unsigned int sort_viable_target_list (void)
void send_appropriate_message (short attacker, short victim)
int inflict_damage (short attacker, short victim, short damage, const FixedVector *impactDirection)
short pilot_hit (short obj)
int onboard_explosion (short obj)
void call_enemy (short obj)
int internal_damage (short attacker, short victim, short damage, short quadrant)
void revise_shields (short obj)
int your_internal_damage (short attacker, short damage, short quadrant)
unsigned int check_computer_damage (void)
short ReportComponentRepaired (short component, short minimumDamage)
void repair_internal_damage (void)
void Create_ship_hit_debris (short obj, short count)
void check_next_wave (void)
unsigned int Create_explosion_debris (short obj)
unsigned int affect_mission_score (short pilot, int event, short amount)
unsigned int score_for_kill (short pilot, short victim)
unsigned int analyze_kill (short attacker, short victim)
short ShipExplosion (short obj)
short Explosion (short obj)
short the_creator (short obj)
int explosion_shock_wave (short obj, short blastDamage)
int explode (short attacker, short victim)
int send_at_point (short obj, FixedVector *point, short speed)
short find_child_object (short parent, enum ObjectClass objectClass)
short find_child_ship (short parent, enum ObjectClass objectClass, short target)
int launch_object (short parent, short child, FixedVector direction, short speed)
void fire (short obj, short target)
short hemisphere (FixedVector *target, FixedVector *parent, FixedVector *hardpoint)
int fire_flack (short owner, short explosion, short range, FixedVector *aim)
short rnd_sign (short v)
int rnd_aim (short radius, short speed, short maximum)
short pop_flack (short obj, short range, FixedVector *hardpoint)
short build_target_list (short obj, short range)
int fire_turrets (short obj)
int fire_weapon (short obj, short weapon)
short find_weapon (short obj, enum ObjectType weaponType)
int fire_missile (short ship)
int fire_fixed_projectile_weapon (short obj)
int drop_mine (short obj, signed char weapon, enum ObjectType type, short lifetime)
void fire_afterburner (short obj, short time)
unsigned int fire_super_brake (short ship)
short flip_angle (short ship, short angle)
unsigned int place_exhaust_on_ships (void)
unsigned int reposition_fixed_child_objects (void)
unsigned int housekeep_power_plant_and_fuel (short ship)
unsigned int replenish_shields (short ship)
unsigned int replenish_weapon_energy_bank (short ship)
void accelerate (short amount)
void your_afterburner (void)

Variables

short asPlayerDamageSystemTable [50]
static enum ObjectType aaeExplosionDebris [4][7]
enum ObjectType aeShipHitDebrisTypes [3]
signed char acGunRefireDelay [4] = {6, 10, 4, 0}
int nMemoryConfig
int dwOriginalFreeMem
struct Shape * pMouseCursorResource
int nAvailableGameMemory
int nSceneResourceBudgetValue
int nAfterburnerSoundDeadline
int bAfterburnerSfxEnabled

Detailed Description

Ships: damage, explosions and weapons.

Address range 41dee0-4219bf, the Mac ship compilation unit: its symbols, initialize_object through your_afterburner, map in order onto this range.

Definition in file ship.c.

Function Documentation

◆ accelerate()

void accelerate ( short amount)

◆ affect_mission_score()

unsigned int affect_mission_score ( short pilot,
int event,
short amount )

◆ analyze_kill()

unsigned int analyze_kill ( short attacker,
short victim )

◆ any_selected()

short any_selected ( signed char * loadout,
enum ObjectClass objectClass )

Definition at line 114 of file ship.c.

References any_selected(), and aObjectTypeData.

Referenced by any_selected(), and remove_weapon().

◆ approach_speed()

◆ borrow_dust()

short borrow_dust ( void )

Definition at line 78 of file ship.c.

References aeObjectClass, borrow_dust(), and OBJECT_CLASS_DUST.

Referenced by borrow_dust(), and new_object().

◆ build_target_list()

short build_target_list ( short obj,
short range )

Definition at line 1044 of file logic.c.

◆ call_enemy()

◆ celerate()

unsigned int celerate ( short ship,
int delta )

◆ check_computer_damage()

unsigned int check_computer_damage ( void )

Definition at line 916 of file ship.c.

References check_computer_damage(), and damage_your_component().

Referenced by check_computer_damage(), and your_internal_damage().

◆ check_for_lost_control()

◆ check_next_wave()

◆ Create_explosion_debris()

◆ Create_ship_hit_debris()

◆ drop_mine()

int drop_mine ( short obj,
signed char weapon,
enum ObjectType type,
short lifetime )

◆ explode()

◆ Explosion()

◆ explosion_shock_wave()

◆ find_child_object()

short find_child_object ( short parent,
enum ObjectClass objectClass )

Definition at line 1399 of file ship.c.

References acObjOwnersTable, aeObjectClass, find_child_object(), and SPACE_OBJECT_COUNT.

Referenced by find_child_object(), and fire().

◆ find_child_ship()

short find_child_ship ( short parent,
enum ObjectClass objectClass,
short target )

Definition at line 1415 of file ship.c.

References acObjOwnersTable, acShipTargetTable, aeObjectClass, and find_child_ship().

Referenced by find_child_ship(), and fire().

◆ find_weapon()

short find_weapon ( short obj,
enum ObjectType weaponType )

Definition at line 1888 of file ship.c.

References aShipWeaponsTable, find_weapon(), and ShipWeaponSlot::type.

Referenced by find_weapon(), and mine_available().

◆ fire()

◆ fire_afterburner()

◆ fire_fixed_projectile_weapon()

◆ fire_flack()

int fire_flack ( short owner,
short explosion,
short range,
FixedVector * aim )

◆ fire_missile()

◆ fire_super_brake()

unsigned int fire_super_brake ( short ship)

◆ fire_turrets()

◆ fire_weapon()

◆ fix_velocity()

unsigned int fix_velocity ( short obj)

Definition at line 438 of file ship.c.

References anShipSpeed, aShipFwdVec, aShipVelocity, fix_velocity(), and ScaleFixedVector().

Referenced by arrive_from_warp(), fix_velocity(), and set_speed().

◆ flip_angle()

short flip_angle ( short ship,
short angle )

Definition at line 2000 of file ship.c.

References asObjectFlipArray, asObjScreenAngles, and flip_angle().

Referenced by flip_angle(), and place_exhaust_on_ships().

◆ hemisphere()

short hemisphere ( FixedVector * target,
FixedVector * parent,
FixedVector * hardpoint )

Definition at line 1592 of file ship.c.

References ComputeVectorDelta(), hemisphere(), and vector_angle().

Referenced by fire_turrets(), and hemisphere().

◆ housekeep_power_plant_and_fuel()

unsigned int housekeep_power_plant_and_fuel ( short ship)

◆ inflict_damage()

◆ initialize_object()

short initialize_object ( short obj,
enum ObjectType type,
short owner )

◆ initialize_ship()

short initialize_ship ( enum ObjectType type,
short owner )

◆ internal_damage()

◆ launch_object()

int launch_object ( short parent,
short child,
FixedVector direction,
short speed )

◆ match_rotation_goal()

unsigned int match_rotation_goal ( short * rotation,
short * goal,
short totalError,
short rate )

Definition at line 287 of file ship.c.

References match_rotation_goal(), MaxShort(), and MinShort().

Referenced by match_rotation_goal(), rotate_eye_to_goal(), and rotate_object_to_goal().

◆ new_object()

short new_object ( enum ObjectType type,
short owner )

◆ onboard_explosion()

◆ pilot_hit()

◆ place_exhaust_on_ships()

◆ pop_flack()

◆ real_velocity()

◆ remove_weapon()

◆ repair_internal_damage()

◆ replenish_shields()

◆ replenish_weapon_energy_bank()

unsigned int replenish_weapon_energy_bank ( short ship)

◆ ReportComponentRepaired()

short ReportComponentRepaired ( short component,
short minimumDamage )

◆ reposition_fixed_child_objects()

◆ revise_shields()

void revise_shields ( short obj)

◆ rnd_aim()

int rnd_aim ( short radius,
short speed,
short maximum )

Definition at line 1631 of file ship.c.

References MinShort(), RandomBelowOrEqual(), rnd_aim(), and rnd_sign().

Referenced by pop_flack(), and rnd_aim().

◆ rnd_sign()

short rnd_sign ( short v)

Definition at line 1623 of file ship.c.

References RandomBelowOrEqual(), and rnd_sign().

Referenced by rnd_aim(), and rnd_sign().

◆ rotate_object_to_goal()

◆ score_for_kill()

◆ send_appropriate_message()

◆ send_at_point()

int send_at_point ( short obj,
FixedVector * point,
short speed )

◆ set_objects_data()

void set_objects_data ( short obj,
enum ObjectType type,
short owner )

Definition at line 173 of file ship.c.

References aasShipArmor, aasShipMaximumShieldTable, aasShipShield, acLastCollisionObjects, acObjOwnersTable, acPilotHitPointsArray, acPreviousAttackers, acShipDmg, acShipIonDriveDmg, acShipTargetTable, aeObjectClass, aeObjectTypeList, ObjectTypeData::afterburnerVelocity, animate_shape(), ObjectTypeData::animation, anShipFuelsTable, aObjectTypeData, apObjShapeArray, ObjectTypeData::armorFront, ObjectTypeData::armorLeft, ObjectTypeData::armorRear, ObjectTypeData::armorRight, aShipWeaponsTable, asObjAfterburnerVelocities, asObjectAnimationDelay, asObjectAnimIndexes, asObjectCollisionRadius, asObjectFlipArray, asObjectViewFrames, asObjScreenAngles, asShipAccumulatedDmg, asShipWpnEnergyList, awObjectScales, awObjMassArray, ObjectTypeData::collisionRadius, eSelectedGunType, init_ijk(), ObjectTypeData::lifetime, ObjectTypeData::mass, nSelectedReleaseWeaponIndex, OBJECT_CLASS_DUST, OBJECT_CLASS_MISSILE, OBJECT_CLASS_PROJECTILE, OBJECT_CLASS_SHIP, OBJECT_TYPE_ASTEROID1, OBJECT_TYPE_ASTEROID2, OBJECT_TYPE_ASTEROID3, OBJECT_TYPE_ASTEROID4, OBJECT_TYPE_ASTEROID5, OBJECT_TYPE_ASTEROID6, OBJECT_TYPE_DEBRIS_METAL_SHEET, OBJECT_TYPE_DEBRIS_PIPE, OBJECT_TYPE_DEBRIS_SHIP_GIRDER_CHUNK, OBJECT_TYPE_DEBRIS_WING, OBJECT_TYPE_EXPLOSION0, OBJECT_TYPE_EXPLOSION1, OBJECT_TYPE_EXPLOSION2, OBJECT_TYPE_ROCK_CHUNK, OBJECT_TYPE_SPACE_DUST, ObjectTypeData::objectClass, recalc_max_velocity(), ObjectTypeData::scale, set_objects_data(), ObjectTypeData::shapeSet, ObjectTypeData::shieldAft, ObjectTypeData::shieldFore, ObjectTypeData::weaponLoadout, and ObjectTypeData::yawRate.

Referenced by animate_object(), Create_explosion_debris(), Create_ship_hit_debris(), ejection_sequence(), Explosion(), fire_flack(), house_keep_objects(), init_hazard(), initialize_object(), make_shard(), object_collision(), onboard_explosion(), place_exhaust_on_ships(), prepare_mission(), set_objects_data(), ShipExplosion(), ShowTigerClawEscapeScene(), start_dust(), unwarp(), update_star_field(), and warp().

◆ ShipExplosion()

◆ sort_viable_target_list()

◆ steady_object()

◆ the_creator()

short the_creator ( short obj)

Definition at line 1276 of file ship.c.

References acObjOwnersTable, and the_creator().

Referenced by explode(), explosion_shock_wave(), and the_creator().

◆ your_afterburner()

◆ your_internal_damage()

Variable Documentation

◆ aaeExplosionDebris

enum ObjectType aaeExplosionDebris[4][7]
static

◆ acGunRefireDelay

signed char acGunRefireDelay[4] = {6, 10, 4, 0}

Definition at line 55 of file ship.c.

Referenced by fire_weapon().

◆ aeShipHitDebrisTypes

enum ObjectType aeShipHitDebrisTypes[3]

◆ asPlayerDamageSystemTable

short asPlayerDamageSystemTable[50]
Initial value:
= {
0, 8, 6, 5, 0, 3, 5, 5, 7, 6,
0, 8, 6, 5, 4, 3, 4, 0, 4, 4,
1, 2, 5, 2, 7, 3, 4, 7, 5, 1,
1, 4, 1, 5, 2, 3, 4, 7, 2, 1,
4, 4, 4, 4, 0, 8, 6, 5, 4, 0
}

Definition at line 13 of file ship.c.

Referenced by your_internal_damage().

◆ bAfterburnerSfxEnabled

int bAfterburnerSfxEnabled

Definition at line 64 of file ship.c.

Referenced by accelerate_and_move_object(), and ResetSoundState().

◆ dwOriginalFreeMem

int dwOriginalFreeMem

Definition at line 59 of file ship.c.

Referenced by LoadOriginFxDrivers(), LogMemoryUsage(), and ShowMemoryStatusDebug().

◆ nAfterburnerSoundDeadline

int nAfterburnerSoundDeadline

Definition at line 63 of file ship.c.

Referenced by your_afterburner().

◆ nAvailableGameMemory

int nAvailableGameMemory

Definition at line 61 of file ship.c.

Referenced by init_mission(), and LoadOriginFxDrivers().

◆ nMemoryConfig

◆ nSceneResourceBudgetValue

int nSceneResourceBudgetValue

Definition at line 62 of file ship.c.

Referenced by init_mission(), InitializeCockpitResources(), and Title_Sequence().

◆ pMouseCursorResource

struct Shape* pMouseCursorResource

Definition at line 60 of file ship.c.

Referenced by InitializeEventManagerResources().