26 #include "../../cl_shared.h" 50 #define XVI_EVENT_NAME "rs_alien_xvi_event" 100 const float heightPerDegree = height / 180.0f;
101 const float widthPerDegree = width / 360.0f;
104 const float AREA_FACTOR = 650.0f;
108 const float normalizingArea = width * height / AREA_FACTOR;
114 for (
int y = 0; y < height; y++) {
115 const byte* previousNationColor;
123 Vector2Set(currentPos, 180.0
f, 90.0
f - y / heightPerDegree);
127 for (
int x = 0; x < width; x++) {
128 const byte* nationColor;
129 currentPos[0] = 180.0f - x / widthPerDegree;
132 previousNationColor = nationColor;
138 sum[nation->
idx] += xviLevel;
143 for (
int nationIdx = 0; nationIdx <
ccs.
numNations; nationIdx++)
144 xviInfection[nationIdx] += ((
float) sum[nationIdx]) / (cos(
torad * currentPos[1]) * normalizingArea);
151 nation->stats[0].xviInfection = ceil(xviInfection[nationIdx]);
154 cgi->Free(xviInfection);
226 for (
int y = 0; y < height; y++) {
227 for (
int x = 0; x < width; x++) {
266 if (x >= 0 && x < width && y >= 0 && y <= height)
291 for (
int i = 0;
i < numAlienBases;
i++)
int CP_GetAverageXVIRate(void)
Return the average XVI rate.
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)
const nationInfo_t * NAT_GetCurrentMonthInfo(const nation_t *const nation)
Get the current month nation stats.
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
void CP_UpdateNationXVIInfection(void)
Update xviInfection value for each nation, using the XVI overlay.
#define MIS_Foreach(var)
iterates through missions
bool XVI_SaveXML(xmlNode_t *p)
XVI map saving callback.
void CP_SetXVILevel(int x, int y, int value)
static bool xviNationInfectionNeedsUpdate
boolean used to know if each nation XVI level should be updated this day.
Detailed information about the nation relationship (currently per month, but could be used elsewhere)...
void CP_DecreaseXVILevelEverywhere(void)
static const int XVI_DECREASE_DAYS
Number of days between 2 XVI decrease (everywhere around the world).
static technology_t * rsAlienXVI
technology for XVI event
const byte * GEO_GetColor(const vec2_t pos, mapType_t type, bool *coast)
Returns the color value from geoscape of a certain mask (terrain, culture or population) at a given p...
memPool_t * cp_campaignPool
Functions to generate and render overlay for geoscape.
void CP_SpreadXVIAtPos(const vec2_t pos)
Spread XVI at a given position.
#define NAT_Foreach(var)
iterates trough nations
#define Vector2Set(v, x, y)
void CP_GetXVIMapDimensions(int *width, int *height)
Campaign missions headers.
int getDateAsDays() const
Return the date part of the DateTime as days.
const cgame_import_t * cgi
void CP_ReduceXVIEverywhere(void)
Reduce XVI everywhere.
bool CP_IsXVIVisible(void)
Returns true if the XVI effect should be visible to the player.
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Header for Geoscape management.
technology_t * RS_GetTechByID(const char *id)
return a pointer to the technology identified by given id string
static const float XVI_FACTOR
The factor that is used to determine XVI radius spreading. The higher this factor, the faster XVI will spread.
#define VectorCompare(a, b)
bool XVI_LoadXML(xmlNode_t *p)
Load the XVI map from the savegame.
XML tag constants for savegame.
#define Mem_PoolAllocTypeN(type, n, pool)
int CP_GetXVILevel(int x, int y)
void CP_StartXVISpreading_f(void)
Start XVI spreading in campaign.
This is the technology parsed from research.ufo.
void CP_SpreadXVI(void)
Spread XVI for each mission that needs to be daily spread.
void CP_InitializeXVIOverlay(void)
Initialize XVI overlay on geoscape.
Header file for single player campaign control.
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
void CP_ChangeXVILevel(const vec2_t pos, float factor)
Convert the pos into degrees and increase XVI there.
void CP_UpdateXVIMapButton(void)
This will hide or show the geoscape button for handling the xvi overlay map.
#define CP_IsXVIStarted()
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
#define XVI_EVENT_NAME
Name of the technology for the XVI event.
mission_t * CP_CreateNewMission(interestCategory_t category, bool beginNow)
Create a new mission of given category.