14 0, 8, 6, 5, 0, 3, 5, 5, 7, 6,
15 0, 8, 6, 5, 4, 3, 4, 0, 4, 4,
16 1, 2, 5, 2, 7, 3, 4, 7, 5, 1,
17 1, 4, 1, 5, 2, 3, 4, 7, 2, 1,
18 4, 4, 4, 4, 0, 8, 6, 5, 4, 0
96 if (obj == -1 && owner == 0)
120 for (weapon = 0; weapon < loadout[0] && selected == 0;
124 .objectClass == objectClass &&
136 signed char *loadout;
143 if (weapon < loadout[0] - 1) {
144 for (slot = weapon; slot < loadout[0] - 1; slot++) {
145 signed char *entry = loadout + slot * 7;
154 loadout[loadout[0] * 7 + 7] = 1;
288 short totalError,
short rate)
292 if (totalError != 0) {
297 step =
MaxShort(1, (
short)(abs(*rotation - *goal) *
299 if (*goal != *rotation || step < abs(*rotation)) {
301 *rotation = (short)(*rotation +
304 (
short)(
MinShort(*goal, step) - *rotation),
308 *rotation = (short)(*rotation +
311 (
short)(
MaxShort(*goal, (
short)-step) -
320 *goal =
MaxShort((
short)(*goal - *rotation), 0);
322 *goal =
MinShort((
short)(*goal - *rotation), 0);
379 overshoot = (short)(overshoot / turnRate);
397 if (speed > maximumSpeed)
414 acceleration += acceleration;
415 if ((delta < 0 ? -delta : delta) > acceleration)
457 for (outer = 0; outer < count - 1; outer++) {
458 for (inner = outer + 1; inner < count; inner++) {
465 if (distance > innerDistance) {
528 return explode(attacker, victim);
536 if (attacker != -1 &&
544 damage = (short)(damage - *strength);
547 if (attacker != -1 &&
556 else if (sideDot < -0xb5)
559 damage = (short)(damage - *strength);
577 destroyed =
explode(attacker, victim);
587 *strength = (short)-damage;
589 *strength = (short)-damage;
590 if (attacker != -1 &&
648 for (; other < 10; other++) {
664 short damageCapacity;
667 signed char weaponCount;
671 victimIndex = victim;
679 if (attacker != -1 && attacker < 10 &&
690 return explode(attacker, victim);
697 damage =
MaxShort(1, (
short)(damage / 40));
700 damage =
MaxShort(1, (
short)(damage / 6));
723 return explode(attacker, victim);
736 return explode(attacker, victim);
741 if (weaponCount > 0) {
742 system = (short)(weaponCount - 1);
761 type].lifetime / 4));
764 return explode(attacker, victim);
799 signed char severity;
802 tableGroup = quadrant == 1 ? 2 : 0;
803 events =
MaxShort(1, (
short)(damage >> 4));
807 events =
MaxShort(1, (
short)(damage >> 7));
809 tableGroup = quadrant == 1 ? 3 : 1;
810 events =
MaxShort(1, (
short)(damage >> 5));
826 else if (severity < 7)
892 playerType].lifetime / 4));
931 sprintf(message,
"%s FIXD",
975 if (created >= count)
991 }
while (created < count);
1001 for (obj = 0; obj < 10; obj++) {
1020 for (index = 0; index < 7; index++) {
1037 for (index = 0; index < 8; index++) {
1094 score = (short)(amount * 2);
1172 unsigned short originalScale;
1177 if (explosion == -1) {
1195 originalScale >> 8);
1215 (missionShip != -1 &&
1226 for (; missionShip < 10; missionShip++) {
1231 if (missionShip < 10)
1243 for (; count != 0; count--) {
1284 if (obj == owner || owner == -1)
1302 for (; other < 10; other++) {
1312 if (distance > 1000) {
1315 if (distance > 750) {
1319 if (distance <= 500)
1320 divisor =
find_ratio(0, 500, distance, 8, 25);
1322 damage = (short)((blastDamage / divisor) / divisor);
1325 (
short)(damage * 3 >> 2));
1381 if (attacker != -1 &&
1402 short wantedParent = parent;
1420 for (obj = 0; obj < 10; obj++) {
1452 short velocityAngle;
1455 short weaponVelocity;
1459 short predictionTime;
1460 short predictedSeparation;
1464 int minePresent = 0;
1485 if (closingSpeed < 0)
1486 weaponVelocity = (short)(weaponVelocity + closingSpeed / 100);
1488 (short)(weaponData->
lifetime * weaponVelocity) > range;
1492 switch (weaponClass) {
1494 if (canFire && targetInRange) {
1495 switch (weaponType) {
1511 (
signed char)!shouldFire;
1528 velocityAngle >= 75 && range <= 2000 &&
1534 predictionTime = (short)(900 /
1536 predictedSeparation = (short)(predictionTime *
1537 (
short)(-20 - closingSpeed) + range);
1538 if (closingSpeed == -20)
1541 mineTime = (short)(range / (closingSpeed + 20));
1547 obj, (
signed char)weapon, weaponType,
1548 (
short)(mineTime + 15));
1549 if (firedObject != -1) {
1551 (
int)mineTime, &direction);
1555 &direction, interceptPoint);
1558 interceptPoint, &direction);
1565 if (fireMissile && targetInRange) {
1566 switch (weaponType) {
1600 return vector_angle(parentFromHardpoint, parentFromTarget);
1607 short projectileVelocity;
1610 projectileVelocity =
1613 lifetime = (short)(range / projectileVelocity -
1631int rnd_aim(
short radius,
short speed,
short maximum)
1653 if (explosion != -1) {
1654 aimRadius =
MaxShort(400, (
short)(range >> 2));
1656 randomAim.
x =
rnd_aim(aimRadius, targetSpeed, 1500);
1657 randomAim.
y =
rnd_aim(aimRadius, targetSpeed, 1500);
1658 randomAim.
z =
rnd_aim(aimRadius, targetSpeed, 1500);
1672 fire_flack(obj, explosion, range, &aimPoint);
1691 short targetHemisphere;
1694 if (lastTarget-- == 0)
1704 targetIndex = startTarget;
1712 if (targetHemisphere > 50 &&
1715 (
signed char)target;
1720 if (targetHemisphere >= 25) {
1728 if (targetIndex > lastTarget)
1730 }
while (targetIndex != startTarget);
1747 short projectileSpeed;
1750 projectileSpeed = 10;
1761 return drop_mine(obj, (
signed char)weapon, weaponType, -1);
1766 if (projectile != -1) {
1780 weaponOffset + 1))->hardpoint,
1788 range = (short)((weaponData->
lifetime + 5) *
1791 range << 8, &vector);
1803 (
int)projectileSpeed << 8, &vector);
1821 switch (weaponType) {
1864 switch (weaponType) {
1898 if (weaponSlot->
type == weaponType)
2005 if ((flip & 0x10) != 0)
2006 angle = (short)(180 - angle);
2007 if ((flip & 0x20) != 0)
2008 angle = (short)-angle;
2025 for (ship = 0; ship < 10; ship++) {
2033 if (animation != 0) {
2036 animation = (
short *)((
unsigned char *)animation +
object);
2037 while (*animation != -1) {
2043 frame = *animation++;
2044 scale = *animation++;
2047 scale = (short)(scale - 32);
2062 (short)(frame * 2 + 12 +
2143 for (shield = 0; shield <= 1; shield++) {
2162 short maximumShield;
2175 (short)(maximumShield +
2177 if (shieldEnergy < maximumShield) {
2179 MinShort((
short)(energy + 1), 100);
2182 MinShort((
short)(energy + 2), 100);
2192 amount = (short)(amount - 2);
unsigned char cYellowColour
signed char acShipRating[16]
signed char acShipDestroyedWeaponCountArray[16]
short asViableTgtDistList[16]
enum ShipTactic aeShipTacticArray[12]
short asObjScreenScalesArray[SPACE_OBJECT_COUNT]
short anShipMissionShips[16]
signed char abShipExhaustHeatList[10]
signed char acViableTargetList[16]
short nMissionMedalScoreValue
int bAfterburnerSfxEnabled
signed char acShipStressList[16]
signed char aShipWeaponsTable[10][0x47]
signed char acPlayerComponentDamageList[9]
short asObjScreenAngles[SPACE_OBJECT_COUNT]
enum ShipManeuver aeShipManeuversTable[12]
ObjectTypeData aObjectTypeData[OBJECT_TYPE_COUNT]
short aasShipMaximumShieldTable[10][2]
short anObjectRollRotationList[SPACE_OBJECT_COUNT]
signed char cViableTargetCount
short anObjectYawRotation[SPACE_OBJECT_COUNT]
short anObjPitchRot[SPACE_OBJECT_COUNT]
short asShipAccumulatedDmg[SPACE_OBJECT_COUNT]
signed char acShipIonDriveDmg[16]
short asShipMaximumSpeedArray[16]
signed char acShipDmg[10]
short nFacingToTargetValue
short asShipWpnEnergyList[10]
short nTargetLockCountdown
FixedVector aShipRightVector[64]
short asObjAfterburnerVelocities[SPACE_OBJECT_COUNT]
short asTargetListRangesArray[16]
int bCurrentPlayerDestroyed
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
short aasShipArmor[10][4]
signed char acFormationMemberLists[16]
const char * apszComponentNames[9]
short asObjectScreenYArray[SPACE_OBJECT_COUNT]
FixedVector aShipVelocity[SPACE_OBJECT_COUNT]
short asObjectCollisionRadius[64]
short asShipAfterburnerTimer[16]
short aasShipShield[10][2]
signed char cCurrentCockpitView
short asCapitalShipViewFramesTable[16]
struct Shape * pMouseCursorResource
int nSceneResourceBudgetValue
unsigned short asObjDistancesTable[SPACE_OBJECT_COUNT]
enum ObjectType eSelectedGunType
short asObjectCounterArray[SPACE_OBJECT_COUNT]
FixedVector aShipUpVector[64]
CampaignState stCampaignState
short asObjectScreenXList[SPACE_OBJECT_COUNT]
signed char acObjOwnersTable[64]
short nCurrentSpaceFrameValue
unsigned short awObjectScales[SPACE_OBJECT_COUNT]
struct Shape * apObjShapeArray[SPACE_OBJECT_COUNT]
signed char acObjCollisionGraceTicks[SPACE_OBJECT_COUNT]
int nSelectedReleaseWeaponIndex
enum ObjectType aeObjectTypeList[SPACE_OBJECT_COUNT]
signed char acLastCollisionObjects[SPACE_OBJECT_COUNT]
short asObjectViewFrames[SPACE_OBJECT_COUNT]
short asObjectFlipArray[SPACE_OBJECT_COUNT]
unsigned short awObjMassArray[SPACE_OBJECT_COUNT]
MissionShipRecord aMissionShips[MISSION_SHIP_STORAGE_COUNT]
signed char acPreviousAttackers[16]
short asObjectAnimationDelay[SPACE_OBJECT_COUNT]
short nShipMissionIndices[10]
FixedVector aShipPositionsArray[SPACE_OBJECT_COUNT]
FixedVector aShipFwdVec[64]
signed char acShipTargetTable[16]
signed char acShipCommunicatorArray[16]
signed char acPilotHitPointsArray[16]
int nAfterburnerSoundDeadline
int nCurrentWingmanKilledThisMission
enum SpecialManeuver aeSpecialManeuvers[12]
short asObjectAnimIndexes[SPACE_OBJECT_COUNT]
enum ObjectType aeShipHitDebrisTypes[3]
signed char acGunRefireDelay[4]
short asPlayerDamageSystemTable[50]
static enum ObjectType aaeExplosionDebris[4][7]
enum ObjectClass objectClass
unsigned char * animation
short afterburnerVelocity
unsigned char weaponLoadout[0x47]
Umbrella header for the game core.
int fire_flack(short owner, short explosion, short range, FixedVector *aim)
void damage_ion_drive(short ship, short amount, short maximum)
short the_creator(short obj)
short pilot_hit(short obj)
short ShipExplosion(short obj)
short find_child_ship(short parent, enum ObjectClass objectClass, short target)
long MultiplyFixed(int left, int right)
int send_at_point(short obj, FixedVector *point, short speed)
unsigned int fire_super_brake(short ship)
short pop_flack(short obj, short range, FixedVector *hardpoint)
void place_damage_on_cockpit(short damage)
void FillFixedVectorWithRandomComponents(short limit, FixedVector *vector)
unsigned int steady_object(short ship)
int dot_product(const FixedVector *left, const FixedVector *right)
void Create_ship_hit_debris(short obj, short count)
int drop_mine(short obj, signed char weapon, enum ObjectType type, short lifetime)
unsigned int score_for_kill(short pilot, short victim)
void remove_object(short obj)
void fire_afterburner(short obj, short time)
int explosion_shock_wave(short obj, short blastDamage)
short recalc_max_velocity(short ship)
unsigned int analyze_kill(short attacker, short victim)
int rnd_aim(short radius, short speed, short maximum)
long Vector_magnitude(const FixedVector *vector)
unsigned int animate_shape(short obj)
void AddFixedVectors(const FixedVector *left, const FixedVector *right, FixedVector *sum)
unsigned int match_rotation_goal(short *rotation, short *goal, short totalError, short rate)
void check_next_wave(void)
void set_objects_data(short obj, enum ObjectType type, short owner)
void set_up_next_wave(void)
void your_afterburner(void)
void repair_internal_damage(void)
int inflict_damage(short attacker, short victim, short damage, const FixedVector *impactDirection)
int fire_turrets(short obj)
int fire_missile(short ship)
int launch_object(short parent, short child, FixedVector direction, short speed)
short FixedToShortSaturating(int value)
unsigned int housekeep_power_plant_and_fuel(short ship)
short get_ship_slot(void)
int rotate_object_to_goal(short obj)
long SinFixed(short degrees)
short MinShort(short a, short b)
unsigned int personality_killed(short personality)
unsigned int TriggerPlayerHitPaletteFlash(void)
short find_ratio(short inputMinimum, short inputMaximum, short input, short outputMinimum, short outputMaximum)
short get_ship_max_velocity(short obj)
void InvalidateVduMode(short i)
int onboard_explosion(short obj)
int fire_fixed_projectile_weapon(short obj)
unsigned int select_new_release_weapon(enum ObjectType preferredType)
unsigned int replenish_weapon_energy_bank(short ship)
int explode(short attacker, short victim)
short vector_angle(FixedVector left, FixedVector right)
unsigned int approach_speed(short ship, int targetSpeed)
void copy_frame(short source, short destination)
unsigned int check_computer_damage(void)
int damage_your_component(char component, char amount, char maximum)
void apply_force_to_objects_center(FixedVector *force, short obj)
short initialize_ship(enum ObjectType type, short owner)
long CosFixed(short degrees)
unsigned int set_special(short ship, enum SpecialManeuver special)
void RemovePlayerReleaseWeapon(signed char weapon)
void ScaleFixedVector(const FixedVector *vector, int scale, FixedVector *result)
void ShowComponentHitHudMessage(const char *text, unsigned short colour, short flashCount)
unsigned int sort_viable_target_list(void)
void SetVectorFixedPoint(FixedVector *p, short v)
short build_target_list(short obj, short range)
void send_message(short obj, short message)
void position_child(short parent, short hardpoint, FixedVector *position)
short new_object(enum ObjectType type, short owner)
void zero_vector(FixedVector *vector)
void child_object(short hardpoint, short child, short parent)
short real_velocity(short obj)
void revise_shields(short obj)
unsigned int fix_velocity(short obj)
unsigned int place_exhaust_on_ships(void)
short RandomBelow(short n)
void MakeRandomVectorFixed(short minimum, short maximum, FixedVector *vector)
int any_enemy(short obj, short range)
short hemisphere(FixedVector *target, FixedVector *parent, FixedVector *hardpoint)
short find_child_object(short parent, enum ObjectClass objectClass)
short malf(char component)
void new_space_music_changes(short attacker, short victim)
short ReportComponentRepaired(short component, short minimumDamage)
short find_vacant_3d_object(void)
short initialize_object(short obj, enum ObjectType type, short owner)
void get_facing_range_from_object(short obj, short other)
unsigned int reposition_fixed_child_objects(void)
short flip_angle(short ship, short angle)
int your_internal_damage(short attacker, short damage, short quadrant)
void unflag_ace(short ace, unsigned char bits)
short Explosion(short obj)
void PlaySfxWaveFileByNumber()
unsigned int Create_explosion_debris(short obj)
void point_at(short obj, FixedVector point)
void fire(short obj, short target)
void call_enemy(short obj)
unsigned int check_for_lost_control(short obj)
void divide_vector(FixedVector *vector, int divisor, FixedVector *result)
int internal_damage(short attacker, short victim, short damage, short quadrant)
void ComputeVectorDelta(const FixedVector *from, const FixedVector *to, FixedVector *delta)
int skill_check(short obj, short difficulty)
unsigned int select_new_gun(void)
unsigned int affect_mission_score(short pilot, int event, short amount)
short MaxShort(short a, short b,...)
void vector_component_in_dir(const FixedVector *vector, const FixedVector *direction, FixedVector *component)
void accelerate(short amount)
void send_appropriate_message(short attacker, short victim)
short any_selected(signed char *loadout, enum ObjectClass objectClass)
void FreePacketAndClear(void *slot, unsigned short releaseFlags)
short find_ship_index(short missionShip)
unsigned int SignFixed(int v)
short __stdcall RandomInRange(short lo, short hi)
int fire_weapon(short obj, short weapon)
unsigned int remove_weapon(short obj, short weapon)
int alert_flag(short ship, unsigned int bits)
unsigned int replenish_shields(short ship)
unsigned int celerate(short ship, int delta)
void reset_maneuver(short ship, short maneuver)
short ace_status(short ace, unsigned char bits)
short RandomBelowOrEqual(short n)
short NormalizeFixedVector(FixedVector *vector)
void drain_fuel(short ship, short amount)
short find_weapon(short obj, enum ObjectType weaponType)
int GetShipAccelerationRate(short ship)
#define SPACE_LAST_MOVING_OBJECT
@ OBJECT_TYPE_KILRATHI_BASE
@ OBJECT_TYPE_NEUTRON_PARTICLE_GUN
@ OBJECT_TYPE_HEAT_SEEKING_MISSILE
@ OBJECT_TYPE_DEBRIS_METAL_SHEET
@ OBJECT_TYPE_MASS_DRIVER_CANNON
@ OBJECT_TYPE_DEBRIS_WING
@ OBJECT_TYPE_DEBRIS_GLASS
@ OBJECT_TYPE_DEBRIS_DUST
@ OBJECT_TYPE_IMAGE_RECOGNITION_MISSILE
@ OBJECT_TYPE_DEBRIS_O_RING
@ OBJECT_TYPE_LASER_CANNON
@ OBJECT_TYPE_DEBRIS_PIPE
@ OBJECT_TYPE_DUMB_FIRE_MISSILE
@ OBJECT_TYPE_DEBRIS_SHIP_GIRDER_CHUNK
@ OBJECT_TYPE_DEBRIS_SHIP_TUBING
#define SPACE_OBJECT_COUNT
@ SPECIAL_MANEUVER_BLOWING_UP
@ SPECIAL_MANEUVER_SUPER_BRAKE
@ SPECIAL_MANEUVER_UNKNOWN_9
@ SPECIAL_MANEUVER_KILL_ENGINES
@ SPECIAL_MANEUVER_AFTERBURNER
@ OBJECT_CLASS_FIXED_OBJECT
@ OBJECT_CLASS_CAPITAL_SHIP
@ OBJECT_CLASS_PROJECTILE