42static cvar_t* debug_showInterest;
45#define GLOBE_ROTATE -90
46#define ZOOM_LIMIT 2.5f
87 return cgi->Cvar_GetInteger(
"geo_overlay_radar");
92 return cgi->Cvar_GetInteger(
"geo_overlay_nation");
97 return cgi->Cvar_GetInteger(
"geo_overlay_xvi");
109 switch (
ccs.mapAction) {
117 cgi->Cmd_ExecuteString(
"mn_set_base_title");
118 cgi->UI_PushWindow(
"popup_newbase");
128 cgi->UI_PushWindow(
"popup_newinstallation");
137 cgi->UI_ExecuteConfunc(
"ui_clear_geoscape_selection");
138 int selection_count = 0;
145 cgi->UI_ExecuteConfunc(
"ui_add_geoscape_selection \"%s\" \"%d\" \"%s\"",
153 cgi->UI_ExecuteConfunc(
"ui_add_geoscape_selection \"%s\" \"%d\" \"%s\"",
154 "aircraft", aircraft->idx, aircraft->name);
161 while ((base =
B_GetNext(base)) !=
nullptr) {
164 cgi->UI_ExecuteConfunc(
"ui_add_geoscape_selection \"%s\" \"%d\" \"%s\"",
165 "base", base->
idx, base->
name);
173 cgi->UI_ExecuteConfunc(
"ui_add_geoscape_selection \"%s\" \"%d\" \"%s\"",
174 "installation", installation->idx, installation->name);
182 cgi->UI_ExecuteConfunc(
"ui_add_geoscape_selection \"%s\" \"%lu\" \"%s\"",
188 if (selection_count > 0) {
190 cgi->UI_PushWindow(
"popup_geoscape_selection");
251 *x = (
int) (mid[0] - radius *
v[1]);
252 *y = (
int) (mid[1] - radius *
v[0]);
255 *z = (
int) (radius *
v[2]);
262 if (*x <
data.mapPos[0] && *y <
data.mapPos[1]
263 && *x >
data.mapPos[0] +
data.mapSize[0]
264 && *y >
data.mapPos[1] +
data.mapSize[1])
283 float sx = pos[0] / 360 +
data.center[0] - 0.5;
291 *x =
data.mapPos[0] + 0.5f *
data.mapSize[0] - sx *
data.mapSize[0] *
data.zoom;
292 *y =
data.mapPos[1] + 0.5f *
data.mapSize[1] - (pos[1] / 180.0f +
data.center[1] - 0.5f) *
data.mapSize[1] *
data.zoom;
294 if (*x <
data.mapPos[0] && *y <
data.mapPos[1]
295 && *x >
data.mapPos[0] +
data.mapSize[0]
296 && *y >
data.mapPos[1] +
data.mapSize[1])
313 if (!
data.flatgeoscape)
325#define UI_MAP_DIST_SELECTION 15
352 if (
data.flatgeoscape) {
359 cgi->R_Draw2DMapMarkers(screenPos, theta, model, skin);
377 float cosTrafo, sinTrafo;
378 float phiStart, phiEnd, dPhi, phi;
399 cosTrafo = cos(trafo[1] *
torad);
400 sinTrafo = sin(trafo[1] *
torad);
402 sa[0] = start[0] - trafo[0];
405 ea[0] = end[0] - trafo[0];
409 phiStart = atan2(s[1], cosTrafo * s[2] - sinTrafo * s[0]);
410 phiEnd = atan2(e[1], cosTrafo * e[2] - sinTrafo * e[0]);
413 if (phiEnd < phiStart -
M_PI)
415 if (phiEnd > phiStart +
M_PI)
428 dPhi = (phiEnd - phiStart) / n;
430 for (phi = phiStart,
i = 0;
i <= n; phi += dPhi,
i++) {
431 const float* last = p;
433 VectorSet(
v, -sinTrafo * cos(phi), sin(phi), cosTrafo * cos(phi));
438 while (p[0] < -180.0)
440 while (p[0] > +180.0)
443 while (p[0] - last[0] > +180.0)
445 while (p[0] - last[0] < -180.0)
460 const vec4_t color = {1, 0.5, 0.5, 1};
469 old =
data.mapSize[0] / 2;
474 if (
i > start && abs(p->
x - old) >
data.mapSize[0] / 2) {
478 if (p->
x - old >
data.mapSize[0] / 2)
479 diff = -
data.mapSize[0] *
data.zoom;
485 cgi->R_DrawLineStrip(
i - start, (
int*)(&pts));
490 pts[0].
x = p[-1].
x - diff;
497 cgi->R_DrawLineStrip(
i - start, (
int*)(&pts));
498 cgi->R_Color(
nullptr);
510 const vec4_t color = {1, 0.5, 0.5, 1};
512 int numPoints, start;
527 cgi->R_DrawLineStrip(numPoints, (
int*)(&pts[start]));
528 cgi->R_Color(
nullptr);
531#define CIRCLE_DRAW_POINTS 60
545 vec3_t initialVector, rotationAxis, currentPoint, centerPos;
557 bool oldDraw =
false;
561 int xCircle, yCircle;
568 if (
data.flatgeoscape && numPoints != 0 && abs(pts[numPoints - 1].x - xCircle) > 512)
574 if (draw != oldDraw &&
i != 0) {
575 cgi->R_DrawLineStrip(numPoints, (
int*)(&pts));
580 pts[numPoints].
x = xCircle;
581 pts[numPoints].
y = yCircle;
589 cgi->R_DrawLineStrip(numPoints, (
int*)(&pts));
590 cgi->R_Color(
nullptr);
603 vec3_t start3D, end3D, north3D, ortToDest, ortToPole,
v;
604 const vec2_t northPole = {0.0f, 90.0f};
663 vec3_t start3D, end3D, tangentVector,
v, rotationAxis;
700 float angle =
todeg * atan(tangentVector[0] / tangentVector[1]);
701 if (tangentVector[1] > 0)
724 if (!
data.flatgeoscape)
738 Vector2Set(vector, objectPos[0], objectPos[1]);
740 VectorSet(vector, objectPos[0], -objectPos[1], 0);
749 if (mission ==
nullptr)
780 if (
data.flatgeoscape) {
784 Vector2Set(
data.smoothFinal2DGeoscapeCenter, 0.5f -
data.smoothFinal2DGeoscapeCenter[0] / 360.0f,
785 0.5f -
data.smoothFinal2DGeoscapeCenter[1] / 180.0f);
790 diff[0] =
data.smoothFinal2DGeoscapeCenter[0] -
data.center[0];
791 diff[1] =
data.smoothFinal2DGeoscapeCenter[1] -
data.center[1];
792 data.smoothDeltaLength = sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
803 data.smoothDeltaZoom = fabs(
data.smoothFinalZoom -
data.zoom);
804 data.smoothRotation =
true;
817 const bool flatgeoscape =
data.flatgeoscape;
820 vector =
data.smoothFinal2DGeoscapeCenter;
822 vector =
data.smoothFinalGlobeAngle;
837 if (
cgi->Cmd_Argc() != 3) {
838 cgi->Com_Printf(
"Usage: %s <mission|ufo> <id>\n",
cgi->Cmd_Argv(0));
842 const char*
type =
cgi->Cmd_Argv(1);
843 const int idx = atoi(
cgi->Cmd_Argv(2));
845 const bool flatgeoscape =
data.flatgeoscape;
849 vector =
data.smoothFinal2DGeoscapeCenter;
851 vector =
data.smoothFinalGlobeAngle;
858 cgi->Com_Printf(
"GEO_SelectObject_f: type %s unsupported.",
type);
878 maxEventIdx = numMissions + numBases +
INS_GetCount() - 1;
880 while ((base =
B_GetNext(base)) !=
nullptr) {
891 if (maxEventIdx < 0) {
905 if (!mission->onGeoscape)
915 counter = numMissions;
920 while ((base =
B_GetNext(base)) !=
nullptr) {
974 if (!
Q_streq(
cgi->UI_GetActiveWindowName(),
"geoscape"))
1020 cgi->R_Color(color);
1021 cgi->R_DrawLine(points, 2.0);
1022 cgi->R_Color(
nullptr);
1027 cgi->R_DrawImageCentered(x, y, image);
1030#define SELECT_CIRCLE_RADIUS 1.5f + 3.0f / UI_MAPEXTRADATACONST(node).zoom
1042 if (isCurrentSelectedMission)
1049 if (isCurrentSelectedMission) {
1051 if (
data.flatgeoscape) {
1064 if (
data.flatgeoscape) {
1081 const vec4_t color = {1., 1., 1., .4};
1098 if (!
radar->numUFOs)
1112 const vec4_t color = {1., 1., 1., .3};
1113 cgi->R_Color(color);
1114 for (
int i = 0;
i <
radar->numUFOs;
i++) {
1119 cgi->R_DrawLineStrip(2, (
int*)pts);
1122 cgi->R_Color(
nullptr);
1134 bool oneUFOVisible,
const char* font)
1174 bool oneUFOVisible,
const char* font)
1228 const int width = 8 *
data.zoom;
1229 const int height = 1 *
data.zoom * 0.9f;
1248 if (!
data.flatgeoscape)
1254 const vec4_t bordercolor = {1, 1, 1, 1};
1256 cgi->R_DrawRect(centerX - width / 2, centerY - 5 *
data.zoom, width, height, bordercolor, 1.0, 1);
1289 if (!
data.flatgeoscape)
1305 if (!
data.flatgeoscape)
1314 if (!
data.flatgeoscape)
1325 if (oneUFOVisible ||
cgi->Cvar_GetInteger(
"debug_showcrafthealth") >= 1)
1359 Q_strcat(buffer,
size,
_(
"Distance to target:\t\t%.0f\n"), distance);
1403 cgi->UI_ExecuteConfunc(
"clean_geoscape_object");
1407 if (!mission->onGeoscape)
1409 cgi->UI_ExecuteConfunc(
"add_geoscape_object mission %i \"%s\" \"%s\n%s\"",
1411 (mission->mapDef) ?
_(mission->mapDef->description) :
"");
1418 cgi->UI_ExecuteConfunc(
"add_geoscape_object ufo %i %s \"%s\"",
1438 const vec4_t white = {1.f, 1.f, 1.f, 0.7f};
1439 int maxInterpolationPoints;
1446 font =
cgi->UI_GetFontFromNode(node);
1453 if (!mission->onGeoscape)
1465 while ((base =
B_GetNext(base)) !=
nullptr)
1479 if (
cgi->Cvar_GetInteger(
"debug_showufos")) {
1491 if (!
data.flatgeoscape)
1495 if (!
data.flatgeoscape) {
1507 ||
cgi->Cvar_GetInteger(
"debug_showcrafthealth") >= 1)
1512 if (
ccs.gameTimeScale > 0)
1513 maxInterpolationPoints = floor(1.0f / (
ccs.frametime * (
float)
ccs.gameTimeScale));
1515 maxInterpolationPoints = 0;
1518 for (
int i = 0;
i <
ccs.numProjectiles;
i++) {
1520 vec3_t drawPos = {0, 0, 0};
1531 const float xInterpolStep = (projectile->
projectedPos[0][0] - projectile->
pos[0][0]) / (
float)maxInterpolationPoints;
1542 }
else if (projectile->
beam) {
1563 static char buffer[512];
1570 cgi->UI_DrawString(
"f_verysmall",
ALIGN_UC, x , y,
_(nation->name));
1582 cgi->R_Color(
nullptr);
1592 data->active =
false;
1596 data->active =
true;
1597 data->map =
ccs.curCampaign->map;
1608 switch (
ccs.mapAction) {
1610 cgi->UI_RegisterText(
TEXT_STANDARD,
_(
"Select the desired location of the new base on the map.\n"));
1613 cgi->UI_RegisterText(
TEXT_STANDARD,
_(
"Select the desired location of the new installation on the map.\n"));
1634 if (debug_showInterest->
integer) {
1721 else if (destroyed &&
ccs.geoscape.selectedUFO > ufo)
1723 ccs.geoscape.selectedUFO--;
1748 const vec3_t fcolor = {color[0] / 255.0f, color[1] / 255.0f, color[2] / 255.0f};
1750 cgi->Com_DPrintf(
DEBUG_CLIENT,
"GEO_GetNation: color value for %.0f:%.0f is r:%i, g:%i, b: %i\n", pos[0], pos[1], color[0], color[1], color[2]);
1758 cgi->Com_DPrintf(
DEBUG_CLIENT,
"GEO_GetNation: No nation found at %.0f:%.0f - color: %i:%i:%i\n", pos[0], pos[1], color[0], color[1], color[2]);
1803 return "nopopulation";
1816 return cgi->csi->terrainDefs.getTerrainName(color);
1854 cgi->Com_Error(
ERR_DROP,
"GEO_GetPopulationType: Trying to get number of civilian in a position on water");
1883 cgi->Com_Printf(
" (Terrain: %s, Culture: %s, Population: %s, Coast: %s)\n",
1884 terrainType, cultureType, populationType, coast ?
"true" :
"false");
1893 while (pos[0] > 180.0)
1895 while (pos[0] < -180.0)
1897 while (pos[1] > 90.0)
1899 while (pos[1] < -90.0)
1910 float p, q, a, root, x;
1916 p = (0.5 + pos[0] / 360 - p) * (2 *
M_PI) - q;
1917 a = -sin(pos[1] *
torad);
1918 root = sqrt(1.0 - a * a);
1970 assert(pos[0] >= -180);
1971 assert(pos[0] <= 180);
1972 assert(pos[1] >= -90);
1973 assert(pos[1] <= 90);
1976 x = (180 - pos[0]) / 360 * width;
1978 y = (90 - pos[1]) / 180 * height;
1988 assert(4 * (x + y * width) < width * height * 4);
1989 color = mask + 4 * (x + y * width);
1990 if (coast !=
nullptr) {
1997 const byte* coastCheck = mask + 4 * ((x - gap) + y * width);
2000 if (!*coast && x < width - 1 - gap) {
2001 const byte* coastCheck = mask + 4 * ((x + gap) + y * width);
2007 const byte* coastCheck = mask + 4 * (x + (y - gap) * width);
2010 if (!*coast && y < height - 1 - gap) {
2011 const byte* coastCheck = mask + 4 * (x + (y + gap) * width);
2033 while ((base =
B_GetNext(base)) !=
nullptr)
2060 if (!terrainTypes ||
cgi->LIST_ContainsString(terrainTypes, terrainType) || (coast &&
cgi->LIST_ContainsString(terrainTypes,
"coast"))) {
2061 if (!cultureTypes ||
cgi->LIST_ContainsString(cultureTypes, cultureType)) {
2062 if (!populationTypes ||
cgi->LIST_ContainsString(populationTypes, populationType)) {
2066 if (nationAtPos && (!nations ||
cgi->LIST_ContainsString(nations, nationAtPos->
id))) {
2088 pos[0] = (
frand() - 0.5f) * 360.0f;
2089 pos[1] = asin((
frand() - 0.5f) * 2.0f) *
todeg;
2092 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_GetRandomPosOnGeoscape: Get random position on geoscape %.2f:%.2f\n", pos[0], pos[1]);
2118 const float numPoints = 360.0 /
RASTER;
2121 const float offsetY = -1.0 +
frand() * 2.0 / numPoints;
2129 for (y = 0; y < numPoints; y++) {
2130 const float posY = asin(2.0 * y / numPoints + offsetY) *
todeg;
2131 for (x = 0; x < numPoints; x++) {
2132 const float posX = x *
RASTER - 180.0 + offsetX;
2151 randomNum = num = rand() % hits;
2154 for (y = 0; y < numPoints; y++) {
2155 const float posY = asin(2.0 * y / numPoints + offsetY) *
todeg;
2156 for (x = 0; x < numPoints; x++) {
2157 const float posX = x *
RASTER - 180.0 + offsetX;
2166 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_GetRandomPosOnGeoscapeWithParameters: New random coords for a mission are %.0f:%.0f, chosen as #%i out of %i possible locations\n",
2167 pos[0], pos[1], randomNum, hits);
2174 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_GetRandomPosOnGeoscapeWithParameters: New random coordinates for a mission are %.0f:%.0f, chosen as #%i out of %i possible locations\n",
2175 pos[0], pos[1], num, hits);
2179 assert(pos[0] >= -180);
2180 assert(pos[0] <= 180);
2181 assert(pos[1] >= -90);
2182 assert(pos[1] <= 90);
2207 cgi->Com_Error(
ERR_DROP,
"Couldn't load map mask %s_terrain in pics/geoscape", map);
2212 cgi->Com_Error(
ERR_DROP,
"Couldn't load map mask %s_culture in pics/geoscape", map);
2217 cgi->Com_Error(
ERR_DROP,
"Couldn't load map mask %s_population in pics/geoscape", map);
2222 cgi->Com_Error(
ERR_DROP,
"Couldn't load map mask %s_nations in pics/geoscape", map);
2252 if (
Q_streq(overlayID,
"nation")) {
2253 cgi->Cvar_SetValue(
"geo_overlay_nation", status);
2261 if (
Q_streq(overlayID,
"xvi")) {
2262 cgi->Cvar_SetValue(
"geo_overlay_xvi", status);
2264 if (
Q_streq(overlayID,
"radar")) {
2265 cgi->Cvar_SetValue(
"geo_overlay_radar", status);
2276 if (
cgi->Cmd_Argc() != 3) {
2277 cgi->Com_Printf(
"Usage: %s <nation|xvi|radar> <1|0>\n",
cgi->Cmd_Argv(0));
2281 const char* overlay =
cgi->Cmd_Argv(1);
2282 const int status = atoi(
cgi->Cmd_Argv(2));
2283 const bool setRadar =
Q_streq(overlay,
"radar");
2301 debug_showInterest =
cgi->Cvar_Get(
"debug_showinterest",
"0",
CVAR_DEVELOPER,
"Shows the global interest value on geoscape");
DateTime class definition.
Share stuff between the different cgame implementations.
static const int SECONDS_PER_DAY
static const short SECONDS_PER_HOUR
static constexpr float DAYS_PER_YEAR_AVG
const char * AIR_AircraftStatusToName(const aircraft_t *aircraft)
Translates the aircraft status id to a translatable string.
bool AIR_AircraftHasEnoughFuel(const aircraft_t *aircraft, const vec2_t destination)
check if aircraft has enough fuel to go to destination, and then come back home
int AIR_AircraftMenuStatsValues(const int value, const int stat)
Some of the aircraft values needs special calculations when they are shown in the menus.
bool AIR_IsAircraftOnGeoscape(const aircraft_t *aircraft)
Checks whether given aircraft is on geoscape.
int AIR_GetTeamSize(const aircraft_t *aircraft)
Counts the number of soldiers in given aircraft.
bool AIR_IsAircraftInBase(const aircraft_t *aircraft)
Checks whether given aircraft is in its homebase.
#define AIR_Foreach(var)
iterates trough all aircraft
#define AIR_ForeachFromBase(var, base)
iterates trough all aircraft from a specific homebase
base_t * B_GetNext(base_t *lastBase)
Iterates through founded bases.
int B_GetCount(void)
Returns the count of founded bases.
#define B_AtLeastOneExists()
#define B_IsUnderAttack(base)
bool CP_IsRunning(void)
Checks whether a campaign mode game is running.
Header file for single player campaign control.
const cgame_import_t * cgi
static const char * GEO_GetTerrainTypeByPos(const vec2_t pos, bool *coast)
Determine the terrain type under a given position.
static bool GEO_IsNationOverlayActivated(void)
mission_t * GEO_SelectMission(mission_t *mission)
Select the specified mission.
static void GEO_SelectObject_f(void)
Center the view and select an object from the geoscape.
bool GEO_IsNight(const vec2_t pos)
Check whether given position is Day or Night.
static void GEO_DrawMapOnePhalanxAircraft(const uiNode_t *node, aircraft_t *aircraft, bool oneUFOVisible)
Draws one Phalanx aircraft on the geoscape map (2D and 3D).
static void GEO_GetGeoscapeAngle(vec2_t pos)
Returns position of the model corresponding to centerOnEventIdx.
void GEO_Reset(const char *map)
bool GEO_PositionFitsTCPNTypes(const vec2_t pos, const linkedList_t *terrainTypes, const linkedList_t *cultureTypes, const linkedList_t *populationTypes, const linkedList_t *nations)
Checks for a given location, if it fulfills all criteria given via parameters (terrain,...
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
static void GEO_DrawMapOneBase(const uiNode_t *node, const base_t *base, bool oneUFOVisible, const char *font)
Draws one base on the geoscape map (2D and 3D).
static const char * GEO_GetPopulationTypeByPos(const vec2_t pos)
Determine the population type under a given position.
void GEO_Init(const char *map)
void GEO_DrawMarkers(const uiNode_t *node)
Draws all ufos, aircraft, bases and so on to the geoscape map (2D and 3D).
static bool GEO_3DMapToScreen(const uiNode_t *node, const vec2_t pos, int *x, int *y, int *z)
Transform a 2D position on the map to screen coordinates.
bool CP_GetRandomPosOnGeoscapeWithParameters(vec2_t pos, const linkedList_t *terrainTypes, const linkedList_t *cultureTypes, const linkedList_t *populationTypes, const linkedList_t *nations)
Determines a random position on geoscape that fulfills certain criteria given via parameters.
static bool GEO_IsXVIOverlayActivated(void)
static void GEO_Draw3DMarkerIfVisible(const uiNode_t *node, const vec2_t pos, float theta, const char *model, int skin)
Draws a 3D marker on geoscape if the player can see it.
void GEO_NotifyUFORemoved(const aircraft_t *ufo, bool destroyed)
Notify that a UFO has been removed.
bool GEO_Click(const uiNode_t *node, int x, int y, const vec2_t pos)
Click on the map/geoscape.
void GEO_SetOverlay(const char *overlayID, int status)
Turn overlay on/off.
static char textStandard[2048]
static const char * GEO_GetUFOText(char *buffer, size_t size, const aircraft_t *ufo)
Assembles a string for a UFO that is on the geoscape.
static void GEO_DrawRadarLineCoverage(const uiNode_t *node, const radar_t *radar, const vec2_t pos)
Draw only the "wire" Radar coverage.
#define UI_MAP_DIST_SELECTION
maximum distance (in pixel) to get a valid mouse click
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...
static const char * GEO_GetPopulationType(const byte *color)
Translate color value to population type.
void GEO_NotifyAircraftRemoved(const aircraft_t *aircraft)
Notify that an aircraft has been removed from game.
void GEO_InitStartup(void)
Initialise MAP/Geoscape.
static const char * GEO_GetCultureType(const byte *color)
Translate color value to culture type.
static float GEO_AngleOfPath3D(const vec2_t start, const vec2_t end, vec3_t direction, vec3_t ortVector)
Return the angle of a model given its position and destination, on 3D geoscape.
static uiNode_t * geoscapeNode
static int populationHeight
static const vec4_t yellow
#define CIRCLE_DRAW_POINTS
static void GEO_DrawBullets(const uiNode_t *node, const vec3_t pos)
Draws a bunch of bullets on the geoscape map.
void GEO_SelectAircraft(aircraft_t *aircraft)
Select the specified aircraft on the geoscape.
static bool GEO_MapToScreen(const uiNode_t *node, const vec2_t pos, int *x, int *y)
Transform a 2D position on the map to screen coordinates.
static const float defaultBaseAngle
bool GEO_IsRadarOverlayActivated(void)
static void GEO_RenderImage(int x, int y, const char *image)
static void GEO_DrawRadarInMap(const uiNode_t *node, const radar_t *radar, const vec2_t pos)
Draw only the "wire" part of the radar coverage in geoscape.
static byte * populationPic
void GEO_CenterPosition(const vec2_t pos)
Start to rotate or shift the globe to the given position.
void GEO_CenterOnPoint_f(void)
Switch to next model on 2D and 3D geoscape.
static void GEO_DrawAircraftHealthBar(const uiNode_t *node, const aircraft_t *aircraft)
Draws health bar for an aircraft (either phalanx or ufo).
void GEO_UpdateGeoscapeDock(void)
Will add missions and UFOs to the geoscape dock panel.
void GEO_SelectUFO(aircraft_t *ufo)
Select the specified ufo on the geoscape.
static void GEO_MapDrawEquidistantPoints(const uiNode_t *node, const vec2_t center, const float angle, const vec4_t color)
Draw equidistant points from a given point on a menu node.
static void GEO_MapDrawLine(const uiNode_t *node, const mapline_t *line)
Draw a path on a menu node (usually the 2D geoscape map).
static const char * GEO_GetMissionText(char *buffer, size_t size, const mission_t *mission)
Assembles a string for a mission that is on the geoscape.
static void GEO_SetOverlay_f(void)
Console command to call GEO_SetOverlay.
static void GEO_GetUFOAngle(bool flatgeoscape, float *vector, int idx)
center to a ufo
void GEO_PrintParameterStringByPos(const vec2_t pos)
Prints positions parameter in console.
void GEO_CalcLine(const vec2_t start, const vec2_t end, mapline_t *line)
Calculate the shortest way to go from start to end on a sphere.
base_t * GEO_PositionCloseToBase(const vec2_t pos)
Check if given pos is close to an existing base.
int GEO_GetCivilianNumberByPosition(const vec2_t pos)
Get number of civilian on a map at given position.
static void GEO_GetMissionAngle(bool flatgeoscape, float *vector, int id)
center to a mission
void GEO_NotifyMissionRemoved(const mission_t *mission)
Notify that a mission has been removed.
static void GEO_ConvertObjectPositionToGeoscapePosition(bool flatgeoscape, float *vector, const vec2_t objectPos)
Will set the vector for the geoscape position.
static bool GEO_AllMapToScreen(const uiNode_t *node, const vec2_t pos, int *x, int *y, int *z)
Call either GEO_MapToScreen or GEO_3DMapToScreen depending on the geoscape you're using.
#define SELECT_CIRCLE_RADIUS
static const vec4_t green
static const char * GEO_GetCultureTypeByPos(const vec2_t pos)
Determine the culture type under a given position.
static void GEO_DrawMapOneInstallation(const uiNode_t *node, const installation_t *installation, bool oneUFOVisible, const char *font)
Draws one installation on the geoscape map (2D and 3D).
static float GEO_AngleOfPath2D(const vec2_t start, const vec2_t end, vec3_t direction, vec3_t ortVector)
Return the angle of a model given its position and destination, on 2D geoscape.
static const char * GEO_GetAircraftText(char *buffer, size_t size, const aircraft_t *aircraft)
Assembles a string for an aircraft that is on the geoscape.
float GEO_AngleOfPath(const vec2_t start, const vec2_t end, vec3_t direction, vec3_t ortVector)
Select which function should be used for calculating the direction of model on 2D or 3D geoscape.
static void GEO_DrawBeam(const uiNode_t *node, const vec3_t start, const vec3_t end, const vec4_t color)
Draws a energy beam on the geoscape map (laser/particle).
static int populationWidth
void CP_GetRandomPosOnGeoscape(vec2_t pos, bool noWater)
Determines a random position on geoscape.
static void GEO_3DMapDrawLine(const uiNode_t *node, const mapline_t *line)
Draw a path on a menu node (usually the 3Dgeoscape map).
static void GEO_DrawMapOneMission(const uiNode_t *node, const mission_t *mission)
Draws one mission on the geoscape map (2D and 3D).
void GEO_NotifyUFODisappear(const aircraft_t *ufo)
Notify that a UFO disappears on radars.
void GEO_CheckPositionBoundaries(float *pos)
Check that a position (in latitude / longitude) is within boundaries.
static int centerOnEventIdx
static const float MIN_DIST_BASE
Minimum distance between a new mission and an existing base.
static bool GEO_IsPositionSelected(const uiNode_t *node, const vec2_t pos, int x, int y)
Tell if the specified position is considered clicked.
static void GEO_StartCenter(uiNode_t *node)
Start center to the selected point.
void GEO_ResetAction(void)
No more special action on the geoscape.
void GEO_Draw(geoscapeData_t *data)
Draw the geoscape.
Header for Geoscape management.
#define GEO_IsAircraftSelected(aircraft)
#define MapIsRural(color)
#define MapIsNopopulation(color)
#define GEO_SetInterceptorAircraft(interceptor)
#define GEO_SetSelectedAircraft(aircraft)
#define MapIsUrban(color)
#define GEO_SetSelectedUFO(ufo)
#define GEO_IsUFOSelected(ufo)
#define GEO_GetSelectedMission()
#define MapIsSuburban(color)
#define GEO_GetSelectedUFO()
#define GEO_IsInterceptorSelected(aircraft)
#define MapIsAfrican(color)
#define MapIsVillage(color)
#define MapIsWater(color)
#define MapIsWestern(color)
#define MapIsOriental(color)
#define GEO_GetSelectedAircraft()
#define MapIsEastern(color)
#define GEO_IsMissionSelected(mission)
#define GEO_SetSelectedMission(mission)
int INS_GetCount(void)
Get number of installations.
int AII_BaseCanShoot(const base_t *base)
Check if the base has weapon and ammo.
bool AII_InstallationCanShoot(const installation_t *installation)
Check if the installation has a weapon and ammo.
Header for slot management related stuff.
int MIS_GetIdx(const mission_t *mis)
Find idx corresponding to mission.
int CP_CountMissionOnGeoscape(void)
Count the number of mission active and displayed on geoscape.
const char * MIS_GetModel(const mission_t *mission)
Get mission model that should be shown on the geoscape.
const char * MIS_GetName(const mission_t *mission)
Returns a short translated name for a mission.
mission_t * MIS_GetByIdx(int id)
Find mission corresponding to idx.
Campaign missions headers.
#define MIS_Foreach(var)
iterates through missions
const nationInfo_t * NAT_GetCurrentMonthInfo(const nation_t *const nation)
Get the current month nation stats.
#define NAT_Foreach(var)
iterates trough nations
Functions to generate and render overlay for geoscape.
void RADAR_UpdateWholeRadarOverlay(void)
Update radar overlay of base, installation and aircraft range.
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
const char * CP_SecondConvert(int second)
Converts a number of second into a char to display.
void CP_GameTimeStop(void)
Stop game time speed.
Campaign geoscape time header.
const char * UFO_GetName(const aircraft_t *ufocraft)
Returns name of the UFO if UFO has been researched.
bool UFO_IsUFOSeenOnGeoscape(const aircraft_t *ufo)
Check if an aircraft should be seen on geoscape.
aircraft_t * UFO_GetNextOnGeoscape(aircraft_t *lastUFO)
#define UFO_GetGeoscapeIDX(ufo)
bool CP_IsXVIVisible(void)
Returns true if the XVI effect should be visible to the player.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
vec_t VectorNormalize(vec3_t v)
Calculate unit vector for a given vec3_t.
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees)
Rotate a point around a given vector.
void PolarToVec(const vec2_t a, vec3_t v)
Converts longitude and latitude to a 3D vector in Euclidean coordinates.
void PerpendicularVector(vec3_t dst, const vec3_t src)
Finds a vector perpendicular to the source vector.
double GetDistanceOnGlobe(const vec2_t pos1, const vec2_t pos2)
Calculate distance on the geoscape.
void VecToPolar(const vec3_t v, vec2_t a)
Converts vector coordinates into polar coordinates.
void CrossProduct(const vec3_t v1, const vec3_t v2, vec3_t cross)
binary operation on vectors in a three-dimensional space
float frand(void)
Return random values between 0 and 1.
QGL_EXTERN int GLboolean GLfloat * v
QGL_EXTERN GLsizei const GLvoid * data
QGL_EXTERN GLint GLenum type
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
An aircraft with all it's data.
struct aircraft_s * aircraftTarget
struct technology_s * tech
projectile used during fight between two or more aircraft
const objDef_t * aircraftItem
int numInterpolationPoints
aircraft_t * aimedAircraft
vec3_t projectedPos[MAX_MULTIPLE_PROJECTILES]
vec3_t pos[MAX_MULTIPLE_PROJECTILES]
aircraft_t * attackingAircraft
A base with all it's data.
baseWeapon_t batteries[MAX_BASE_SLOT]
baseWeapon_t lasers[MAX_BASE_SLOT]
float stats[AIR_STATS_MAX]
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
A installation with all it's data.
const installationTemplate_t * installationTemplate
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
A path on the map described by 2D points.
vec2_t point[LINE_MAXPTS]
Detailed information about the nation relationship (currently per month, but could be used elsewhere)...
Atomic structure used to define most of the UI.
#define UI_MAPEXTRADATACONST(node)
#define GLOBE_RADIUS
radius of the globe in screen coordinates
#define UI_MAPEXTRADATA(node)
#define VectorEqualEpsilon(a, b, epsilon)
#define LinearInterpolation(a, b, x, y)
#define VectorEqual(a, b)
#define Vector4Copy(src, dest)
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define Vector2Set(v, x, y)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
#define VectorSet(v, x, y, z)
#define Vector2Copy(src, dest)