38 ccs.lastInterestIncreaseDelay = 0;
39 ccs.lastMissionSpawnedDelay = 0;
40 ccs.overallInterest =
ccs.curCampaign->initialInterest;
56 cgi->Com_Printf(
"CP_ChangeIndividualInterest: Unsupported value of category\n");
60 if (interestFactor > 0.0f) {
61 const int gain = (
int) (interestFactor *
ccs.overallInterest);
62 const int diff =
ccs.overallInterest -
ccs.interest[category];
65 const float slowerIncreaseFraction = 0.5f;
70 ccs.interest[category] += gain;
73 ccs.interest[category] =
ccs.overallInterest + (
int) (slowerIncreaseFraction * (gain - diff));
76 ccs.interest[category] += (
int) (slowerIncreaseFraction * gain);
79 ccs.interest[category] += (
int) (interestFactor *
ccs.interest[category]);
80 if (
ccs.interest[category] < 0) {
82 ccs.interest[category] = 0;
97 ccs.lastInterestIncreaseDelay++;
99 if (
ccs.lastInterestIncreaseDelay > delayBetweenIncrease) {
100 ccs.overallInterest++;
101 ccs.lastInterestIncreaseDelay %= delayBetweenIncrease;
145 if (!
cgi->Com_GetConstInt(categoryId, (
int*) &cat)) {
146 cgi->Com_Printf(
"Invalid interest category '%s'\n", categoryId);
166 return "Recon mission";
168 return "Terror mission";
170 return "Base attack";
173 return "Building Base or Subverting Government";
175 return "Supply base";
177 return "XVI propagation";
180 return "Interception";
184 return "Alien base discovered";
186 return "Rescue mission";
188 return "UFO-Carrier";
190 return "Unknown mission category";
201static void INT_AlienInterestList_f (
void)
203 cgi->Com_Printf(
"Overall interest: %i\n",
ccs.overallInterest);
204 cgi->Com_Printf(
"Individual interest:\n");
213static void INT_SetAlienInterest_f (
void)
215 if (
cgi->Cmd_Argc() < 2) {
216 cgi->Com_Printf(
"Usage: %s <interestlevel>\n",
cgi->Cmd_Argv(0));
220 const int interest = atoi(
cgi->Cmd_Argv(1));
221 ccs.overallInterest = std::max(0, interest);
227 {
"debug_interestlist", INT_AlienInterestList_f,
"Debug function to show alien interest values"},
228 {
"debug_interestset", INT_SetAlienInterest_f,
"Set overall interest level."},
230 {
nullptr,
nullptr,
nullptr}
Share stuff between the different cgame implementations.
bool INT_LoadXML(xmlNode_t *parent)
Load callback for savegames in XML Format.
void INT_InitStartup(void)
Init actions for alien interests-subsystem.
void INT_Shutdown(void)
Closing actions for alien interests-subsystem.
void INT_IncreaseAlienInterest(const campaign_t *campaign)
Increase alien overall interest.
void INT_ChangeIndividualInterest(float interestFactor, interestCategory_t category)
Change individual interest value.
static const cmdList_t debugInterestCmds[]
bool INT_SaveXML(xmlNode_t *parent)
Save callback for savegames in XML Format.
void INT_ResetAlienInterest(void)
Initialize alien interest values and mission cycle.
@ INTERESTCATEGORY_BASE_ATTACK
@ INTERESTCATEGORY_INTERCEPTBOMBING
@ INTERESTCATEGORY_ALIENBASE
@ INTERESTCATEGORY_BUILDING
@ INTERESTCATEGORY_SUBVERT
@ INTERESTCATEGORY_SUPPLY
@ INTERESTCATEGORY_UFOCARRIER
@ INTERESTCATEGORY_TERROR_ATTACK
@ INTERESTCATEGORY_INTERCEPT
@ INTERESTCATEGORY_RESCUE
@ INTERESTCATEGORY_HARVEST
Header file for single player campaign control.
#define HOURS_PER_ONE_INTEREST
The amount of time (in hours) it takes for the interest to increase by 1. Is later affected by diffic...
const cgame_import_t * cgi
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
XML tag constants for savegame.
static const constListEntry_t saveInterestConstants[]
#define SAVE_INTERESTS_VAL
#define SAVE_INTERESTS_LASTINCREASEDELAY
#define SAVE_INTERESTS_OVERALL
#define SAVE_INTERESTCAT_NAMESPACE
#define SAVE_INTERESTS_ID
#define SAVE_INTERESTS_LASTMISSIONSPAWNEDDELAY
#define SAVE_INTERESTS_INTEREST