UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_geoscape.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
28#define KILOMETER_PER_DEGREE 111.2 /* this is the conversion between distance in game (in degree) and km */
29
30/* check for water */
31/* blue value is 64 */
32#define MapIsWater(color) (color[0] == 0 && color[1] == 0 && color[2] == 64)
33
34/* culture types */
35#define MapIsWestern(color) (color[0] == 128 && color[1] == 255 && color[2] == 255)
36#define MapIsEastern(color) (color[0] == 255 && color[1] == 128 && color[2] == 0)
37#define MapIsOriental(color) (color[0] == 255 && color[1] == 0 && color[2] == 0)
38#define MapIsAfrican(color) (color[0] == 128 && color[1] == 128 && color[2] == 255)
39
40/* population types */
41#define MapIsUrban(color) (color[0] == 128 && color[1] == 255 && color[2] == 255)
42#define MapIsSuburban(color) (color[0] == 255 && color[1] == 128 && color[2] == 0)
43#define MapIsVillage(color) (color[0] == 255 && color[1] == 0 && color[2] == 0)
44#define MapIsRural(color) (color[0] == 128 && color[1] == 128 && color[2] == 255)
45#define MapIsNopopulation(color) (color[0] == 128 && color[1] == 255 && color[2] == 0)
46
47/* RASTER enables a better performance for CP_GetRandomPosOnGeoscapeWithParameters set it to 1-6
48 * the higher the value the better the performance, but the smaller the coverage */
49#define RASTER 2
50
51#define GEO_IsAircraftSelected(aircraft) ((aircraft) == ccs.geoscape.selectedAircraft)
52#define GEO_IsInterceptorSelected(aircraft) ((aircraft) == ccs.geoscape.interceptAircraft)
53#define GEO_IsUFOSelected(ufo) ((ufo) == ccs.geoscape.selectedUFO)
54#define GEO_IsMissionSelected(mission) ((mission) == ccs.geoscape.selectedMission)
55
56#define GEO_GetSelectedAircraft() (ccs.geoscape.selectedAircraft)
57#define GEO_GetInterceptorAircraft() (ccs.geoscape.interceptAircraft)
58#define GEO_GetSelectedUFO() (ccs.geoscape.selectedUFO)
59#define GEO_GetSelectedMission() (ccs.geoscape.selectedMission)
60#define GEO_GetMissionAircraft() (ccs.geoscape.missionAircraft)
61
62#define GEO_SetSelectedAircraft(aircraft) (ccs.geoscape.selectedAircraft = (aircraft))
63#define GEO_SetInterceptorAircraft(interceptor) (ccs.geoscape.interceptAircraft = (interceptor))
64#define GEO_SetSelectedUFO(ufo) (ccs.geoscape.selectedUFO = (ufo))
65#define GEO_SetSelectedMission(mission) (ccs.geoscape.selectedMission = (mission))
66#define GEO_SetMissionAircraft(aircraft) (ccs.geoscape.missionAircraft = (aircraft))
67
68/* prototype */
69struct uiNode_t;
70
71void GEO_DrawMarkers(const uiNode_t* node);
72bool GEO_Click(const uiNode_t* node, int x, int y, const vec2_t pos);
73
74nation_t* GEO_GetNation(const vec2_t pos);
75float GEO_AngleOfPath(const vec2_t start, const vec2_t end, vec3_t direction, vec3_t ortVector);
76void GEO_CalcLine(const vec2_t start, const vec2_t end, mapline_t* line);
78void GEO_CenterOnPoint_f(void);
79void GEO_CenterPosition(const vec2_t pos);
81
82void GEO_ResetAction(void);
83void GEO_SelectAircraft(aircraft_t* aircraft);
84void GEO_SelectUFO(aircraft_t* ufo);
85struct mission_s* GEO_SelectMission(struct mission_s* mission);
86void GEO_NotifyMissionRemoved(const struct mission_s* mission);
87void GEO_NotifyUFORemoved(const aircraft_t* ufo, bool destroyed);
88void GEO_NotifyAircraftRemoved(const aircraft_t* aircraft);
89void GEO_NotifyUFODisappear(const aircraft_t* ufo);
90void GEO_InitStartup(void);
93void GEO_CheckPositionBoundaries(float* pos);
94bool GEO_IsNight(const vec2_t pos);
95const byte* GEO_GetColor(const vec2_t pos, mapType_t type, bool* coast);
96void GEO_Init(const char* map);
97void GEO_Reset(const char* map);
98void GEO_Shutdown(void);
99bool GEO_PositionFitsTCPNTypes(const vec2_t posT, const linkedList_t* terrainTypes, const linkedList_t* cultureTypes, const linkedList_t* populationTypes, const linkedList_t* nations);
100void GEO_SetOverlay(const char* overlayID, int status);
101void GEO_UpdateGeoscapeDock(void);
103
104void CP_GetRandomPosOnGeoscape(vec2_t pos, bool noWater);
105bool CP_GetRandomPosOnGeoscapeWithParameters(vec2_t pos, const linkedList_t* terrainTypes, const linkedList_t* cultureTypes, const linkedList_t* populationTypes, const linkedList_t* nations);
mapType_t
Definition cp_campaign.h:92
bool GEO_IsNight(const vec2_t pos)
Check whether given position is Day or Night.
void GEO_Reset(const char *map)
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
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).
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.
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.
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...
void GEO_NotifyAircraftRemoved(const aircraft_t *aircraft)
Notify that an aircraft has been removed from game.
void GEO_InitStartup(void)
Initialise MAP/Geoscape.
void GEO_SelectAircraft(aircraft_t *aircraft)
Select the specified aircraft on the geoscape.
bool GEO_PositionFitsTCPNTypes(const vec2_t posT, 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,...
bool GEO_IsRadarOverlayActivated(void)
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.
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.
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.
struct mission_s * GEO_SelectMission(struct mission_s *mission)
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.
void CP_GetRandomPosOnGeoscape(vec2_t pos, bool noWater)
Determines a random position on geoscape.
void GEO_Shutdown(void)
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.
void GEO_NotifyMissionRemoved(const struct mission_s *mission)
void GEO_ResetAction(void)
No more special action on the geoscape.
void GEO_Draw(geoscapeData_t *data)
Draw the geoscape.
QGL_EXTERN GLsizei const GLvoid * data
Definition r_gl.h:89
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
An aircraft with all it's data.
A base with all it's data.
Definition cp_base.h:84
A path on the map described by 2D points.
Definition cp_aircraft.h:39
Nation definition.
Definition cp_nation.h:46
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec2_t[2]
Definition ufotypes.h:38