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

Mission setup, action spheres and ship loading. More...

#include "game.h"

Go to the source code of this file.

Functions

void set_sphere_point (const MissionShipRecord *record, FixedVector *position)
short is_alive (signed char pilot)
void check_futurion (short i)
void ResetWeaponDisplayPositions (void)
void init_mission (short series, short mission)
void ApplyAlternateShipType (short obj)
void LoadAlternateShipType (short resourceType, short logicalFile)
short find_ships_sphere (short missionShip)
void RefreshObjectiveShipNavPoints (void)
void prepare_mission (void)
void FreePacketAndClear (void *slot, unsigned short releaseFlags)
void ReportFatalErrorCode (const char *errorCode)
void release_capital_ship_shapes (short resourceType)
void free_ship (short slot)
short FindObjectResourceSlot (short resourceType)
void ReleasePacketHandle (void *)
void add_hazard_field (short type, FixedVector center, short radius, short density)
void flag_objective (short objective, unsigned char flags)
void * FetchDiskPacketRetrying (char *fileName, short section, short flags)
void release_all_capital_ship_shapes (void)
void load_ship (short resourceType, short objectType, short objectClass, short slot)
void free_all_slots (void)
void load_all_slots (void)
void remove_nav_point_objects (void)
short get_shape_slot (void)
short shape_loaded (short resourceType)
short shape_needed (const MissionNavPoint *navPoint, short resourceType)
void new_sphere_shapes (MissionNavPoint *navPoint)
void ProcessMissionWaveCommands (MissionNavPoint *navPoint)
void set_up_action_sphere (short navPoint)
void ComputeVectorDelta (FixedVector *from, FixedVector *to, FixedVector *delta)
void random_radial (const FixedVector *center, short radius, FixedVector *position)
void place_ship_near_player_until_valid (short obj, short minimum, short maximum)
void Set_up_ship_info (short obj, short missionShip, signed char navPoint)
void remove_object (short obj)
short room_for_me (short obj, short minimum)
short set_up_next_wave (void)
void sub_int_vector (const ShortVector *left, const ShortVector *right, ShortVector *difference)
short find_ship_index (short missionShip)
void set_formation_position (short obj, const MissionShipRecord *record)
short is_team_member (short missionShip)
void find_next_ship_turn_slot (short obj)
short init_ship (short missionShip, short navPoint)
void clear_alert (short obj)
void LoadCommPortraitResources (short portrait)
void init_intelligence_data (short obj)

Variables

short g_bMissionShipInitializationInProgress = 0
short g_bShipResourceReloadInProgress = 0
void ** g_apPacketReferenceGroups [5] = { 0 }
unsigned char g_ucPendingEjectionTransition = 0xff
short g_bEjectionWaitForEnemyWave = 0
short g_bEjectionAwaitingCommCommand = 0
short g_nPendingEjectionSequenceCount = 0
short g_bEjectionTriggerImmediately = 0
short g_nEjectionSequenceState = 0
signed char g_cQueuedNpcPortrait = -1
signed char g_cQueuedNpcMessage = -1
ShortVector g_aaFormationPositions [5][8]
short g_anPilotTurnInterval [8]
short g_1_nEnemyCommCommandBase
short g_nEnemyCommPilotIndex
short g_asCapitalHitDamageStepTable [10]

Detailed Description

Mission setup, action spheres and ship loading.

Definition in file mission.c.

Function Documentation

◆ add_hazard_field()

void add_hazard_field ( short type,
FixedVector center,
short radius,
short density )

Definition at line 411 of file fields.c.

◆ ApplyAlternateShipType()

◆ check_futurion()

void check_futurion ( short i)

◆ clear_alert()

void clear_alert ( short obj)

Definition at line 37 of file logic.c.

◆ ComputeVectorDelta()

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

Definition at line 229 of file geom.c.

◆ FetchDiskPacketRetrying()

void * FetchDiskPacketRetrying ( char * fileName,
short section,
short flags )

Definition at line 187 of file disk.c.

◆ find_next_ship_turn_slot()

void find_next_ship_turn_slot ( short obj)

◆ find_ship_index()

short find_ship_index ( short missionShip)

Definition at line 251 of file logic.c.

◆ find_ships_sphere()

short find_ships_sphere ( short missionShip)

Definition at line 816 of file logic.c.

◆ FindObjectResourceSlot()

short FindObjectResourceSlot ( short resourceType)

Definition at line 401 of file mission.c.

References FindObjectResourceSlot(), and g_aObjectResourceSlots.

Referenced by FindObjectResourceSlot(), and LoadAlternateShipType().

◆ flag_objective()

void flag_objective ( short objective,
unsigned char flags )

Definition at line 1153 of file cockpt.c.

◆ free_all_slots()

◆ free_ship()

◆ FreePacketAndClear()

void FreePacketAndClear ( void * slot,
unsigned short releaseFlags )

Definition at line 45 of file disk.c.

◆ get_shape_slot()

short get_shape_slot ( void )

Definition at line 751 of file mission.c.

References g_aObjectResourceSlots, and get_shape_slot().

Referenced by get_shape_slot(), and new_sphere_shapes().

◆ init_intelligence_data()

◆ init_mission()

◆ init_ship()

◆ is_alive()

short is_alive ( signed char pilot)

Definition at line 61 of file mission.c.

References g_pPilotStatus, and is_alive().

Referenced by init_ship(), is_alive(), and prepare_mission().

◆ is_team_member()

◆ load_all_slots()

◆ load_ship()

◆ LoadAlternateShipType()

◆ LoadCommPortraitResources()

void LoadCommPortraitResources ( short portrait)

Definition at line 25 of file comm.c.

◆ new_sphere_shapes()

◆ place_ship_near_player_until_valid()

void place_ship_near_player_until_valid ( short obj,
short minimum,
short maximum )

◆ prepare_mission()

◆ ProcessMissionWaveCommands()

◆ random_radial()

void random_radial ( const FixedVector * center,
short radius,
FixedVector * position )

Definition at line 278 of file geom.c.

◆ RefreshObjectiveShipNavPoints()

◆ release_all_capital_ship_shapes()

◆ release_capital_ship_shapes()

◆ ReleasePacketHandle()

void ReleasePacketHandle ( void * handle)

Definition at line 108 of file memapi.c.

◆ remove_nav_point_objects()

void remove_nav_point_objects ( void )

Definition at line 742 of file mission.c.

References remove_nav_point_objects(), and remove_object().

Referenced by remove_nav_point_objects().

◆ remove_object()

void remove_object ( short obj)

Definition at line 858 of file geom.c.

◆ ReportFatalErrorCode()

void ReportFatalErrorCode ( const char * errorCode)

Definition at line 29 of file message.c.

◆ ResetWeaponDisplayPositions()

void ResetWeaponDisplayPositions ( void )

◆ room_for_me()

◆ set_formation_position()

◆ set_sphere_point()

◆ set_up_action_sphere()

◆ set_up_next_wave()

◆ Set_up_ship_info()

void Set_up_ship_info ( short obj,
short missionShip,
signed char navPoint )

Definition at line 1135 of file mission.c.

References alter_pitch(), alter_roll(), alter_yaw(), ObjectTypeData::damageCapacity, MissionShipRecord::field_19, find_ship_index(), g_13_abShipArrivalMessageSent, g_27_aasGunCooldown, g_2_asCarrierLaunchTimer, g_2_asFlakCooldownTable, g_aasShipArmor, g_abPilotEjectionAttempted, g_abShipEjectionSequenceEnabled, g_acObjectType, g_acShipCollisionCooldown, g_acShipCommunicator, g_acShipComputerDamage, g_acShipDamage, g_acShipExhaustHeat, g_acShipIonDriveDamage, g_acShipLastAttacker, g_acShipNavPoint, g_acShipPendingMessage, g_acShipPortrait, g_aMissionShips, g_anShipCloakState, g_anShipSpeed, g_aObjectTypeData, g_apShipMissionRecord, g_asActionCount, g_asCapitalHitDamageStepTable, g_aShipPosition, g_aShipVelocity, g_aShipWeapons, g_asLoadedShipViewFrame, g_asObjectDamage, g_asObjectType, g_asPilotLevel, g_asPlayerHitsCreditValues, g_asProjectileEvasionTicks, g_asShipCloakCooldown, g_asShipFriendlyFireCooldown, g_asShipIdentified, g_asShipMissionIndex, g_asShipMissionParameter, g_asShipSide, g_asShipWingLeader, g_asSpikeriCooldown, g_asSpikeriLaunchCountdown, g_asWingmanDamageCredit, g_bKilrathiAceGreetingSent, init_intelligence_data(), MissionShipRecord::leaderMissionIndex, MissionShipRecord::missionParameter, MissionShipRecord::missionType, MissionShipRecord::name, MissionShipRecord::pilot, MissionShipRecord::pitch, MissionShipRecord::portrait, RandomInRange(), recalc_max_velocity(), reset_mission_type(), MissionShipRecord::roll, set_formation_position(), set_sphere_point(), Set_up_ship_info(), ShipHasCloakingDevice(), MissionShipRecord::side, SIDE_KILRATHI, MissionShipRecord::speed, MissionShipRecord::yaw, and zero_vector().

Referenced by init_ship(), launch_carrier_fighter(), prepare_mission(), and Set_up_ship_info().

◆ shape_loaded()

short shape_loaded ( short resourceType)

Definition at line 763 of file mission.c.

References g_aObjectResourceSlots, and shape_loaded().

Referenced by new_sphere_shapes(), and shape_loaded().

◆ shape_needed()

short shape_needed ( const MissionNavPoint * navPoint,
short resourceType )

Definition at line 775 of file mission.c.

References MissionNavPoint::preloadObjectTypes, and shape_needed().

Referenced by new_sphere_shapes(), and shape_needed().

◆ sub_int_vector()

void sub_int_vector ( const ShortVector * left,
const ShortVector * right,
ShortVector * difference )

Definition at line 1093 of file mission.c.

References sub_int_vector(), ShortVector::x, ShortVector::y, and ShortVector::z.

Referenced by set_formation_position(), and sub_int_vector().

Variable Documentation

◆ g_1_nEnemyCommCommandBase

short g_1_nEnemyCommCommandBase

Definition at line 1463 of file mission.c.

Referenced by BuildCommunicationCommandMenu(), init_intelligence_data(), and init_mission().

◆ g_aaFormationPositions

ShortVector g_aaFormationPositions[5][8]
Initial value:
= {
{
{ 0, 0, 0 }, { -750, 0, 0 }, { 750, 0, 0 }, { 0, 0, -750 },
{ 0, 0, 750 }, { -750, 0, -750 }, { 750, 0, -750 },
{ 0, 0, -1500 }
},
{
{ 0, 0, 0 }, { 750, 0, 0 }, { -750, -100, -250 },
{ 1500, -100, -250 }, { -1500, -200, -500 },
{ -2250, -300, -750 }, { 2250, -200, -500 },
{ 3000, -300, -750 }
},
{
{ 0, 0, 0 }, { 750, 0, -500 }, { -750, 0, -500 },
{ 0, 0, -1000 }, { -1500, 0, -1000 }, { -750, 0, -1500 },
{ 1500, 0, -1000 }, { 750, 0, -1500 }
},
{
{ 0, 0, 0 }, { 750, 0, -250 }, { 0, 325, -500 },
{ 750, -325, -750 }, { 0, 325, -500 }, { 750, -325, -750 },
{ 0, 0, -1000 }, { 750, 0, -1250 }
},
{
{ 0, 0, 0 }, { 0, 0, -750 }, { -750, 0, -500 },
{ -750, 0, -1250 }, { 750, 0, -500 }, { 750, 0, -1250 },
{ 0, 500, -500 }, { 0, 500, -1250 }
}
}

Definition at line 19 of file mission.c.

Referenced by set_formation_position().

◆ g_anPilotTurnInterval

short g_anPilotTurnInterval[8]
Initial value:
= {
5, 5, 4, 4, 3, 1, 1, 0
}

Definition at line 47 of file mission.c.

Referenced by find_next_ship_turn_slot().

◆ g_apPacketReferenceGroups

void** g_apPacketReferenceGroups[5] = { 0 }

Definition at line 10 of file mission.c.

Referenced by free_ship(), get_right_shape(), load_ship(), and ReleasePacketHandle().

◆ g_asCapitalHitDamageStepTable

short g_asCapitalHitDamageStepTable[10]

Definition at line 1465 of file mission.c.

Referenced by internal_damage(), and Set_up_ship_info().

◆ g_bEjectionAwaitingCommCommand

short g_bEjectionAwaitingCommCommand = 0

◆ g_bEjectionTriggerImmediately

short g_bEjectionTriggerImmediately = 0

Definition at line 15 of file mission.c.

Referenced by ProcessEnemyWaveCompletion(), and ProcessMissionWaveCommands().

◆ g_bEjectionWaitForEnemyWave

short g_bEjectionWaitForEnemyWave = 0

Definition at line 12 of file mission.c.

Referenced by ProcessEnemyWaveCompletion(), and ProcessMissionWaveCommands().

◆ g_bMissionShipInitializationInProgress

short g_bMissionShipInitializationInProgress = 0

Definition at line 8 of file mission.c.

Referenced by prepare_mission(), and set_formation_position().

◆ g_bShipResourceReloadInProgress

short g_bShipResourceReloadInProgress = 0

Definition at line 9 of file mission.c.

Referenced by load_all_slots(), and load_ship().

◆ g_cQueuedNpcMessage

signed char g_cQueuedNpcMessage = -1

Definition at line 18 of file mission.c.

Referenced by npc_communication(), and ProcessMissionWaveCommands().

◆ g_cQueuedNpcPortrait

signed char g_cQueuedNpcPortrait = -1

Definition at line 17 of file mission.c.

Referenced by npc_communication(), and ProcessMissionWaveCommands().

◆ g_nEjectionSequenceState

short g_nEjectionSequenceState = 0

◆ g_nEnemyCommPilotIndex

short g_nEnemyCommPilotIndex

Definition at line 1464 of file mission.c.

Referenced by BuildCommunicationCommandMenu(), init_intelligence_data(), and init_mission().

◆ g_nPendingEjectionSequenceCount

short g_nPendingEjectionSequenceCount = 0

◆ g_ucPendingEjectionTransition