UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
ui_node_geoscape.h
Go to the documentation of this file.
1
4
5
/*
6
Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17
See the GNU General Public License for more details.
18
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23
*/
24
25
#pragma once
26
27
#include "
../ui_nodes.h
"
28
#include "
ui_node_abstractnode.h
"
29
#include "
../../cl_shared.h
"
30
31
class
uiGeoscapeNode
:
public
uiLocatedNode
{
32
protected
:
33
void
smoothTranslate
(
uiNode_t
* node);
34
void
smoothRotate
(
uiNode_t
* node);
35
void
screenTo3DMap
(
const
uiNode_t
* node,
int
x,
int
y,
vec2_t
pos);
36
void
screenToMap
(
const
uiNode_t
* node,
int
x,
int
y,
vec2_t
pos);
37
void
calcAndUploadDayAndNightTexture
(
uiNode_t
* node,
float
q);
38
public
:
39
void
draw
(
uiNode_t
* node)
override
;
40
void
onMouseUp
(
uiNode_t
* node,
int
x,
int
y,
int
button)
override
;
41
void
onCapturedMouseMove
(
uiNode_t
* node,
int
x,
int
y)
override
;
42
void
onCapturedMouseLost
(
uiNode_t
* node)
override
;
43
void
onLoading
(
uiNode_t
* node)
override
;
44
bool
onScroll
(
uiNode_t
* node,
int
deltaX,
int
deltaY)
override
;
45
void
onLeftClick
(
uiNode_t
* node,
int
x,
int
y)
override
;
46
bool
onStartDragging
(
uiNode_t
* node,
int
startX
,
int
startY
,
int
currentX,
int
currentY,
int
button)
override
;
47
void
zoom
(
uiNode_t
* node,
bool
out);
48
void
startMouseShifting
(
uiNode_t
* node,
int
x,
int
y);
49
};
50
51
#define UI_MAPEXTRADATA_TYPE mapExtraData_t
52
#define UI_MAPEXTRADATA(node) UI_EXTRADATA(node, UI_MAPEXTRADATA_TYPE)
53
#define UI_MAPEXTRADATACONST(node) UI_EXTRADATACONST(node, UI_MAPEXTRADATA_TYPE)
54
55
#define DAN_WIDTH 2048
56
#define DAN_HEIGHT 1024
57
62
#define STANDARD_3D_ZOOM 40.0f
63
64
#define EARTH_RADIUS 8192.0f
65
#define MOON_RADIUS 1024.0f
66
#define SUN_RADIUS 1024.0f
67
69
#define GLOBE_RADIUS EARTH_RADIUS * (UI_MAPEXTRADATACONST(node).zoom / STANDARD_3D_ZOOM)
70
71
typedef
struct
mapExtraData_s {
72
/* Smoothing variables */
73
bool
smoothRotation
;
74
vec3_t
smoothFinalGlobeAngle
;
75
vec2_t
smoothFinal2DGeoscapeCenter
;
76
float
smoothDeltaLength
;
77
float
smoothFinalZoom
;
78
float
smoothDeltaZoom
;
79
float
curZoomSpeed
;
80
float
curRotationSpeed
;
81
82
vec2_t
mapSize
;
83
vec2_t
mapPos
;
84
vec3_t
angles
;
85
vec2_t
center
;
86
float
zoom
;
87
bool
flatgeoscape
;
88
float
ambientLightFactor
;
89
float
mapzoommin
;
90
float
mapzoommax
;
91
float
paddingRight
;
92
int
radarOverlay
;
93
int
nationOverlay
;
94
int
xviOverlay
;
95
geoscapeData_t
*
geoscapeData
;
96
byte
*
r_dayandnightAlpha
;
97
}
mapExtraData_t
;
98
99
void
UI_RegisterGeoscapeNode
(
uiBehaviour_t
* behaviour);
cl_shared.h
Share stuff between the different cgame implementations.
uiGeoscapeNode
Definition
ui_node_geoscape.h:31
uiGeoscapeNode::onLoading
void onLoading(uiNode_t *node) override
Called before loading. Used to set default attribute values.
Definition
ui_node_geoscape.cpp:522
uiGeoscapeNode::screenToMap
void screenToMap(const uiNode_t *node, int x, int y, vec2_t pos)
Return longitude and latitude of a point of the screen for 2D geoscape.
Definition
ui_node_geoscape.cpp:372
uiGeoscapeNode::screenTo3DMap
void screenTo3DMap(const uiNode_t *node, int x, int y, vec2_t pos)
Return longitude and latitude of a point of the screen for 3D geoscape (globe).
Definition
ui_node_geoscape.cpp:392
uiGeoscapeNode::smoothTranslate
void smoothTranslate(uiNode_t *node)
smooth translation of the 2D geoscape
Definition
ui_node_geoscape.cpp:154
uiGeoscapeNode::startMouseShifting
void startMouseShifting(uiNode_t *node, int x, int y)
Definition
ui_node_geoscape.cpp:354
uiGeoscapeNode::onMouseUp
void onMouseUp(uiNode_t *node, int x, int y, int button) override
Definition
ui_node_geoscape.cpp:472
uiGeoscapeNode::onStartDragging
bool onStartDragging(uiNode_t *node, int startX, int startY, int currentX, int currentY, int button) override
Send mouse event when a pressed mouse button is dragged.
Definition
ui_node_geoscape.cpp:455
uiGeoscapeNode::calcAndUploadDayAndNightTexture
void calcAndUploadDayAndNightTexture(uiNode_t *node, float q)
Applies alpha values to the night overlay image for 2d geoscape.
Definition
ui_node_geoscape.cpp:178
uiGeoscapeNode::onCapturedMouseLost
void onCapturedMouseLost(uiNode_t *node) override
Called when the node have lost the captured node We clean cached data.
Definition
ui_node_geoscape.cpp:484
uiGeoscapeNode::draw
void draw(uiNode_t *node) override
Definition
ui_node_geoscape.cpp:214
uiGeoscapeNode::smoothRotate
void smoothRotate(uiNode_t *node)
smooth rotation of the 3D geoscape
Definition
ui_node_geoscape.cpp:98
uiGeoscapeNode::onScroll
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
Definition
ui_node_geoscape.cpp:510
uiGeoscapeNode::zoom
void zoom(uiNode_t *node, bool out)
Definition
ui_node_geoscape.cpp:493
uiGeoscapeNode::onCapturedMouseMove
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
Definition
ui_node_geoscape.cpp:291
uiGeoscapeNode::onLeftClick
void onLeftClick(uiNode_t *node, int x, int y) override
Definition
ui_node_geoscape.cpp:439
uiLocatedNode
Definition
ui_node_abstractnode.h:68
geoscapeData_t
Definition
cl_shared.h:55
mapExtraData_t
Definition
ui_node_geoscape.h:71
mapExtraData_t::radarOverlay
int radarOverlay
Definition
ui_node_geoscape.h:92
mapExtraData_t::mapSize
vec2_t mapSize
Definition
ui_node_geoscape.h:82
mapExtraData_t::r_dayandnightAlpha
byte * r_dayandnightAlpha
Definition
ui_node_geoscape.h:96
mapExtraData_t::smoothFinalZoom
float smoothFinalZoom
Definition
ui_node_geoscape.h:77
mapExtraData_t::curZoomSpeed
float curZoomSpeed
Definition
ui_node_geoscape.h:79
mapExtraData_t::zoom
float zoom
Definition
ui_node_geoscape.h:86
mapExtraData_t::paddingRight
float paddingRight
Definition
ui_node_geoscape.h:91
mapExtraData_t::smoothRotation
bool smoothRotation
Definition
ui_node_geoscape.h:73
mapExtraData_t::center
vec2_t center
Definition
ui_node_geoscape.h:85
mapExtraData_t::mapzoommax
float mapzoommax
Definition
ui_node_geoscape.h:90
mapExtraData_t::mapzoommin
float mapzoommin
Definition
ui_node_geoscape.h:89
mapExtraData_t::nationOverlay
int nationOverlay
Definition
ui_node_geoscape.h:93
mapExtraData_t::xviOverlay
int xviOverlay
Definition
ui_node_geoscape.h:94
mapExtraData_t::smoothFinal2DGeoscapeCenter
vec2_t smoothFinal2DGeoscapeCenter
Definition
ui_node_geoscape.h:75
mapExtraData_t::angles
vec3_t angles
Definition
ui_node_geoscape.h:84
mapExtraData_t::smoothDeltaZoom
float smoothDeltaZoom
Definition
ui_node_geoscape.h:78
mapExtraData_t::mapPos
vec2_t mapPos
Definition
ui_node_geoscape.h:83
mapExtraData_t::smoothDeltaLength
float smoothDeltaLength
Definition
ui_node_geoscape.h:76
mapExtraData_t::ambientLightFactor
float ambientLightFactor
Definition
ui_node_geoscape.h:88
mapExtraData_t::curRotationSpeed
float curRotationSpeed
Definition
ui_node_geoscape.h:80
mapExtraData_t::geoscapeData
geoscapeData_t * geoscapeData
Definition
ui_node_geoscape.h:95
mapExtraData_t::smoothFinalGlobeAngle
vec3_t smoothFinalGlobeAngle
Definition
ui_node_geoscape.h:74
mapExtraData_t::flatgeoscape
bool flatgeoscape
Definition
ui_node_geoscape.h:87
uiBehaviour_t
node behaviour, how a node work
Definition
ui_behaviour.h:39
uiNode_t
Atomic structure used to define most of the UI.
Definition
ui_nodes.h:80
vec3_t
vec_t vec3_t[3]
Definition
ufotypes.h:39
vec2_t
vec_t vec2_t[2]
Definition
ufotypes.h:38
ui_node_abstractnode.h
startY
static int startY
Definition
ui_node_editor.cpp:61
startX
static int startX
Definition
ui_node_editor.cpp:60
UI_RegisterGeoscapeNode
void UI_RegisterGeoscapeNode(uiBehaviour_t *behaviour)
Definition
ui_node_geoscape.cpp:694
ui_nodes.h
src
client
ui
node
ui_node_geoscape.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0