25 #include "../../../DateTime.h" 26 #include "../../../cl_shared.h" 27 #include "../cp_campaign.h" 28 #include "../cp_ufo.h" 29 #include "../cp_missions.h" 30 #include "../cp_time.h" 31 #include "../cp_alien_interest.h" 32 #include "../cp_xvi.h" 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);
Class describing a point of time.
#define AIRFIGHT_WEAPON_CAN_NEVER_SHOOT
void CP_InterceptMissionIsFailure(mission_t *mission)
Intercept mission is over and is a failure: change interest values.
void UFO_SetRandomDest(aircraft_t *ufocraft)
Give a random destination to the given UFO, and make him to move there.
void CP_InterceptNextStage(mission_t *mission)
Determine what action should be performed when a Intercept mission stage ends.
void INT_ChangeIndividualInterest(float interestFactor, interestCategory_t category)
Change individual interest value.
Campaign mission headers.
bool INS_HasAny(installationStatus_t status)
Checks whether any installation is available.
A installation with all it's data.
static installation_t * CP_InterceptChooseInstallation(const mission_t *mission)
Choose Base that will be attacked, and add it to mission description.
static void CP_InterceptAttackInstallation(mission_t *mission)
UFO starts to attack the installation.
void CP_InterceptMissionLeave(mission_t *mission, bool destroyed)
Intercept mission ends: UFO leave earth.
bool UFO_CanDoMission(const ufoType_t uType, const char *mType)
Check if the UFO type is available for the given mission type.
void CP_InterceptAircraftMissionSet(mission_t *mission)
Set Intercept mission: UFO looks for new aircraft target.
union mission_t::missionData_t data
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.
aircraftSlot_t weapons[MAX_AIRCRAFTSLOT]
void CP_InterceptGoToInstallation(mission_t *mission)
Set Intercept mission: UFO chooses an installation an flies to it.
const cgame_import_t * cgi
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.
ufoType_t getUfoType() const
void CP_InterceptMissionIsSuccess(mission_t *mission)
Intercept mission is over and is a success: change interest values.
static void CP_InterceptMissionSet(mission_t *mission)
Set Intercept mission: choose between attacking aircraft or installations.
installation_t * installation
float frand(void)
Return random values between 0 and 1.
DateTime Date_Random(const DateTime &minFrame, const DateTime &maxFrame)
Return a random relative date which lies between a lower and upper limit.
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...
#define Vector2Copy(src, dest)
void UFO_SendToDestination(aircraft_t *ufo, const vec2_t dest)
Make the specified UFO go to destination.
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.
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.
#define CP_IsXVIStarted()
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.