64#define UFO_EPSILON 0.00001f
86 missionPos[2] = installation->
pos[2];
104 const DateTime minAttackDelay(0, 3600);
105 const DateTime maxAttackDelay(0, 21600);
143 float randomNumber, sum = 0.0f;
150 sum +=
i->alienInterest;
152 randomNumber =
frand() * sum;
154 randomNumber -=
i->alienInterest;
155 if (randomNumber < 0) {
162 assert(installation && (randomNumber < 0));
174 assert(mission->
ufo);
180 cgi->Com_Printf(
"CP_InterceptGoToInstallation: no installation found\n");
199 assert(mission->
ufo);
205 const float TARGET_INS_PROBABILITY = 0.25;
207 if (
frand() < TARGET_INS_PROBABILITY)
222 switch (mission->
stage) {
235 assert(mission->
ufo);
240 const DateTime additionalDelay(0, 3600);
250 cgi->Com_Printf(
"CP_InterceptNextStage: Unknown stage: %i, removing mission.\n", mission->
stage);
DateTime class definition.
Share stuff between the different cgame implementations.
Class describing a point of time.
int AIRFIGHT_ChooseWeapon(const aircraftSlot_t *slot, int maxSlot, const vec2_t pos, const vec2_t targetPos)
Choose the weapon an attacking aircraft will use to fire on a target.
#define AIRFIGHT_WEAPON_CAN_NEVER_SHOOT
void INT_ChangeIndividualInterest(float interestFactor, interestCategory_t category)
Change individual interest value.
@ INTERESTCATEGORY_BASE_ATTACK
@ INTERESTCATEGORY_BUILDING
@ INTERESTCATEGORY_TERROR_ATTACK
@ INTERESTCATEGORY_INTERCEPT
@ INTERESTCATEGORY_HARVEST
Header file for single player campaign control.
const cgame_import_t * cgi
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
bool INS_HasAny(installationStatus_t status)
Checks whether any installation is available.
void CP_InterceptMissionIsFailure(mission_t *mission)
Intercept mission is over and is a failure: change interest values.
void CP_InterceptNextStage(mission_t *mission)
Determine what action should be performed when a Intercept mission stage ends.
void CP_InterceptMissionIsSuccess(mission_t *mission)
Intercept mission is over and is a success: change interest values.
void CP_InterceptGoToInstallation(mission_t *mission)
Set Intercept mission: UFO chooses an installation an flies to it.
static void CP_InterceptAttackInstallation(mission_t *mission)
UFO starts to attack the installation.
void CP_InterceptAircraftMissionSet(mission_t *mission)
Set Intercept mission: UFO looks for new aircraft target.
static installation_t * CP_InterceptChooseInstallation(const mission_t *mission)
Choose Base that will be attacked, and add it to mission description.
static void CP_InterceptMissionSet(mission_t *mission)
Set Intercept mission: choose between attacking aircraft or installations.
void CP_InterceptMissionLeave(mission_t *mission, bool destroyed)
Intercept mission ends: UFO leave earth.
Campaign mission headers.
bool CP_MissionBegin(mission_t *mission)
mission begins: UFO arrive on earth.
void CP_MissionRemove(mission_t *mission)
Removes a mission from mission global array.
void CP_MissionRemoveFromGeoscape(mission_t *mission)
Removes a mission from geoscape: make it non visible and call notify functions.
void CP_MissionDisableTimeLimit(mission_t *mission)
Disable time limit for given mission.
Campaign missions headers.
DateTime Date_Random(const DateTime &minFrame, const DateTime &maxFrame)
Return a random relative date which lies between a lower and upper limit.
Campaign geoscape time header.
void UFO_SendToDestination(aircraft_t *ufo, const vec2_t dest)
Make the specified UFO go to destination.
void UFO_SetRandomDestAround(aircraft_t *ufocraft, const vec2_t pos)
Give a random destination to the given UFO close to a position, and make him to move there.
bool UFO_CanDoMission(const ufoType_t uType, const char *mType)
Check if the UFO type is available for the given mission type.
void UFO_SetRandomDest(aircraft_t *ufocraft)
Give a random destination to the given UFO, and make him to move there.
#define CP_IsXVIStarted()
int VectorCompareEps(const vec3_t v1, const vec3_t v2, float epsilon)
Compare two vectors that may have an epsilon difference but still be the same vectors.
float frand(void)
Return random values between 0 and 1.
aircraftSlot_t weapons[MAX_AIRCRAFTSLOT]
ufoType_t getUfoType() const
A installation with all it's data.
union mission_t::missionData_t data
installation_t * installation
#define Vector2Copy(src, dest)