UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_geoscape.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, 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 */
69 struct uiNode_t;
70 
71 void GEO_DrawMarkers(const uiNode_t* node);
72 bool GEO_Click(const uiNode_t* node, int x, int y, const vec2_t pos);
73 
74 nation_t* GEO_GetNation(const vec2_t pos);
75 float GEO_AngleOfPath(const vec2_t start, const vec2_t end, vec3_t direction, vec3_t ortVector);
76 void GEO_CalcLine(const vec2_t start, const vec2_t end, mapline_t* line);
78 void GEO_CenterOnPoint_f(void);
79 void GEO_CenterPosition(const vec2_t pos);
81 
82 void GEO_ResetAction(void);
83 void GEO_SelectAircraft(aircraft_t* aircraft);
84 void GEO_SelectUFO(aircraft_t* ufo);
85 struct mission_s* GEO_SelectMission(struct mission_s* mission);
86 void GEO_NotifyMissionRemoved(const struct mission_s* mission);
87 void GEO_NotifyUFORemoved(const aircraft_t* ufo, bool destroyed);
88 void GEO_NotifyAircraftRemoved(const aircraft_t* aircraft);
90 void GEO_InitStartup(void);
93 void GEO_CheckPositionBoundaries(float* pos);
94 bool GEO_IsNight(const vec2_t pos);
95 const byte* GEO_GetColor(const vec2_t pos, mapType_t type, bool* coast);
96 void GEO_Init(const char* map);
97 void GEO_Reset(const char* map);
98 void GEO_Shutdown(void);
99 bool GEO_PositionFitsTCPNTypes(const vec2_t posT, const linkedList_t* terrainTypes, const linkedList_t* cultureTypes, const linkedList_t* populationTypes, const linkedList_t* nations);
100 void GEO_SetOverlay(const char* overlayID, int status);
101 void GEO_UpdateGeoscapeDock(void);
102 bool GEO_IsRadarOverlayActivated(void);
103 
104 void CP_GetRandomPosOnGeoscape(vec2_t pos, bool noWater);
105 bool CP_GetRandomPosOnGeoscapeWithParameters(vec2_t pos, const linkedList_t* terrainTypes, const linkedList_t* cultureTypes, const linkedList_t* populationTypes, const linkedList_t* nations);
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.
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 GEO_CenterPosition(const vec2_t pos)
Start to rotate or shift the globe to the given position.
void GEO_Shutdown(void)
Nation definition.
Definition: cp_nation.h:44
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
void GEO_SetOverlay(const char *overlayID, int status)
Turn overlay on/off.
struct mission_s * GEO_SelectMission(struct mission_s *mission)
Select the specified mission.
void GEO_UpdateGeoscapeDock(void)
Will add missions and UFOs to the geoscape dock panel.
enum mapType_s mapType_t
void GEO_CenterOnPoint_f(void)
Switch to next model on 2D and 3D geoscape.
mission definition
Definition: cp_missions.h:85
void GEO_PrintParameterStringByPos(const vec2_t pos)
Prints positions parameter in console.
bool GEO_IsRadarOverlayActivated(void)
Definition: cp_geoscape.cpp:84
int GEO_GetCivilianNumberByPosition(const vec2_t pos)
Get number of civilian on a map at given position.
void GEO_Draw(geoscapeData_t *data)
Draw the geoscape.
A base with all it's data.
Definition: cp_base.h:84
bool GEO_IsNight(const vec2_t pos)
Check whether given position is Day or Night.
void GEO_NotifyUFORemoved(const aircraft_t *ufo, bool destroyed)
Notify that a UFO has been removed.
void GEO_NotifyUFODisappear(const aircraft_t *ufo)
Notify that a UFO disappears on radars.
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, culture, population, nation type)
aircraft_t * ufo
Definition: cp_missions.h:105
void GEO_Reset(const char *map)
void GEO_ResetAction(void)
No more special action on the geoscape.
void GEO_DrawMarkers(const uiNode_t *node)
Draws all ufos, aircraft, bases and so on to the geoscape map (2D and 3D)
void GEO_SelectUFO(aircraft_t *ufo)
Select the specified ufo on the geoscape.
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
void GEO_SelectAircraft(aircraft_t *aircraft)
Select the specified aircraft on the geoscape.
void GEO_CheckPositionBoundaries(float *pos)
Check that a position (in latitude / longitude) is within boundaries.
bool GEO_Click(const uiNode_t *node, int x, int y, const vec2_t pos)
Click on the map/geoscape.
void GEO_InitStartup(void)
Initialise MAP/Geoscape.
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
void CP_GetRandomPosOnGeoscape(vec2_t pos, bool noWater)
Determines a random position on geoscape.
base_t * GEO_PositionCloseToBase(const vec2_t pos)
Check if given pos is close to an existing base.
void GEO_Init(const char *map)
GLsizei const GLvoid * data
Definition: r_gl.h:152
void GEO_NotifyMissionRemoved(const struct mission_s *mission)
An aircraft with all it's data.
Definition: cp_aircraft.h:114
uint8_t byte
Definition: ufotypes.h:34
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...
vec2_t pos
Definition: cp_missions.h:104
A path on the map described by 2D points.
Definition: cp_aircraft.h:38
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.