Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Vegastrike 0.5.1 rc1
Todo List
Modules
Namespaces
Classes
Files
File List
src
aldrv
audio
cmd
common
gfx
nav
radar
ani_texture.cpp
ani_texture.h
animation.cpp
animation.h
aux_logo.cpp
aux_logo.h
aux_palette.cpp
aux_palette.h
aux_texture.cpp
aux_texture.h
background.cpp
background.h
background_server.cpp
bmp_to_png.cpp
camera.cpp
camera.h
car_assist.h
cockpit.cpp
cockpit.h
cockpit_generic.cpp
cockpit_generic.h
cockpit_xml.cpp
coord_select.cpp
coord_select.h
decalqueue.h
env_map_gent.cpp
env_map_gent.h
gauge.cpp
gauge.h
halo.cpp
halo.h
halo_system.cpp
halo_system.h
hud.cpp
hud.h
jpeg_memory.cpp
jpeg_memory.h
lerp.cpp
lerp.h
loc_select.cpp
loc_select.h
masks.cpp
masks.h
matrix.cpp
matrix.h
mesh.cpp
mesh.h
mesh_bin.cpp
mesh_bin_server.cpp
mesh_bxm.cpp
mesh_bxm.h
mesh_fx.cpp
mesh_gfx.cpp
mesh_io.h
mesh_poly.cpp
mesh_server.cpp
mesh_xml.cpp
mesh_xml.h
nonlinear_transform.h
particle.cpp
particle.h
pipelined_texture.cpp
pipelined_texture.h
point_to_cam.h
quadsquare.cpp
quadsquare.h
quadsquare_cull.cpp
quadsquare_render.cpp
quadsquare_update.cpp
quadtree.cpp
quadtree.h
quadtree_xml.cpp
quaternion.cpp
quaternion.h
raw_to_png.cpp
ring.cpp
ring.h
screenshot.cpp
screenshot.h
sphere.cpp
sphere.h
sphere_generic.cpp
sphere_server.cpp
sprite.cpp
sprite.h
star.cpp
star.h
stream_texture.cpp
stream_texture.h
technique.cpp
technique.h
tex_transform.cpp
vdu.cpp
vdu.h
vec.cpp
vec.h
vertex.h
vid_file.cpp
vid_file.h
vsbox.cpp
vsbox.h
vsbox_server.cpp
vsimage.cpp
vsimage.h
warptrail.cpp
warptrail.h
xvector.h
gldrv
gui
networking
python
accountserver.cpp
audiolib.h
cg_global.cpp
cg_global.h
command.cpp
command.h
config_xml.cpp
config_xml.h
configxml.cpp
configxml.h
cs_boostpython.h
cs_boostpythonclass.h
cs_boostpythonobj.h
cs_python.h
debug_vs.cpp
debug_vs.h
easydom.cpp
easydom.h
endianness.cpp
endianness.h
faction_generic.cpp
faction_generic.h
faction_util.cpp
faction_util_generic.cpp
faction_util_server.cpp
fastmath.cpp
ffmpeg_init.cpp
ffmpeg_init.h
file_main.h
force_feedback.cpp
force_feedback.h
force_feedback_server.cpp
functors.h
galaxy.cpp
galaxy_gen.cpp
galaxy_gen.h
galaxy_xml.cpp
galaxy_xml.h
gamemenu.cpp
gamemenu.h
gfxlib.h
gfxlib_struct.cpp
gfxlib_struct.h
gfxlib_struct_server.cpp
gnuhash.h
hashtable.cpp
hashtable.h
in.h
in_handler.h
in_joystick.cpp
in_joystick.h
in_kb.cpp
in_kb.h
in_kb_data.h
in_main.cpp
in_main.h
in_mouse.cpp
in_mouse.h
in_sdl.cpp
junk.c
libaudioserver.cpp
libserver.cpp
lin_time.cpp
lin_time.h
linecollide.h
load_mission.cpp
load_mission.h
macosx_math.cpp
macosx_math.h
macquartz.cpp
main.cpp
main_loop.cpp
main_loop.h
mmorpgclient.cpp
mmorpgclient.h
options.cpp
options.h
physics.cpp
physics.h
pk3.cpp
pk3.h
posh.cpp
posh.h
precompiled.h
profile.h
rendertext.cpp
rendertext.h
replaceall.py
resizable.h
save_util.h
savegame.cpp
savegame.h
SharedPool.cpp
SharedPool.h
ship_commands.cpp
ship_commands.h
Singleton.h
star_system.cpp
star_system.h
star_system_generic.cpp
star_system_generic.h
star_system_jump.cpp
star_system_xml.cpp
stardate.cpp
stardate.h
universe.cpp
universe.h
universe_generic.cpp
universe_generic.h
universe_util.cpp
universe_util.h
universe_util_generic.cpp
universe_util_server.cpp
vegaserver.cpp
vegastrike.h
vs_globals.cpp
vs_globals.h
vs_math.h
vs_random.h
vsfilesystem.cpp
vsfilesystem.h
VSFileXMLSerializer.cpp
VSFileXMLSerializer.h
xml_serializer.cpp
xml_serializer.h
xml_support.cpp
xml_support.h
XMLDocument.cpp
XMLDocument.h
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
coord_select.cpp
Go to the documentation of this file.
1
#include "
cmd/unit_generic.h
"
2
#include "
star_system.h
"
3
#include "
loc_select.h
"
4
#include "
coord_select.h
"
5
#include "
vs_globals.h
"
6
#include "
in_kb.h
"
7
#include "
gfx/camera.h
"
8
int
CoordinateSelectChange
= 0;
9
int
CoordinateSelectmousex
;
10
int
CoordinateSelectmousey
;
11
extern
Vector
MouseCoordinate
(
int
mouseX,
int
mouseY );
12
extern
KBSTATE
keyState
[
LAST_MODIFIER
][
KEYMAP_SIZE
];
13
void
CoordinateSelect::MouseMoveHandle
(
KBSTATE
,
int
x
,
int
y
,
int
,
int
,
int
)
14
{
15
if
(
keyState
[0][
'z'
] ==
DOWN
)
16
CoordinateSelectChange
= 2;
17
else
18
CoordinateSelectChange
= 1;
19
CoordinateSelectmousex
=
x
;
20
CoordinateSelectmousey
=
y
;
21
}
22
23
CoordinateSelect::CoordinateSelect
(
QVector
start
) : LocSelAni(
"locationselect.ani"
, true, .5,
MIPMAP
, true )
24
, LocalPosition( start )
25
{
26
CrosshairSize
= 2;
27
CoordinateSelectmousex
=
g_game
.
x_resolution
/2;
28
CoordinateSelectmousey
=
g_game
.
y_resolution
/2;
29
CoordinateSelectChange
= 1;
30
}
31
void
CoordinateSelect::UpdateMouse
()
32
{
33
if
(
CoordinateSelectChange
== 1) {
34
Vector
CamPos;
35
Vector
CamQ, CamR;
36
_Universe
->
AccessCamera
()->
GetPQR
( CamPos, CamQ, CamR );
37
38
Vector
mousePoint(
MouseCoordinate
(
CoordinateSelectmousex
,
CoordinateSelectmousey
) );
39
float
mouseDistance = mousePoint.k*mousePoint.k;
40
mousePoint =
Transform
( CamPos, CamQ, CamR, mousePoint );
41
//QVector cp;
42
CamPos =
_Universe
->
AccessCamera
()->
GetPosition
();
43
//float mouseDistance = mousePoint.Dot (CamR);
44
//distance out into z...straight line...
45
46
float
distance = CamR.Dot( (
LocalPosition
-CamPos).Cast() );
//distance out into z...straight line...
47
//VSFileSystem::Fprintf (stderr, "distance:%f\n",distance);
48
//VSFileSystem::Fprintf (stderr, "mdistance:%f %f\n",mouseDistance,TMD);
49
if
(mouseDistance != 0)
50
LocalPosition
= mousePoint*(distance/mouseDistance)+CamPos.Cast();
51
else
52
LocalPosition
= 2*CamR+CamPos.Cast();
53
CoordinateSelectChange
= 0;
54
}
55
if
(
CoordinateSelectChange
== 2) {
56
Vector
CamPos, CamQ, CamR;
57
_Universe
->
AccessCamera
()->
GetPQR
( CamPos, CamQ, CamR );
58
CamPos =
_Universe
->
AccessCamera
()->
GetPosition
();
59
60
LocalPosition
=
LocalPosition
-CamPos;
61
float
distance =
sqrt
( CamR.Dot(
LocalPosition
) );
//distance out into z...straight line...
62
//make it a ratio btw top and bottom.... for near and far;
63
float
ratio =
float
(
g_game
.
y_resolution
-
CoordinateSelectmousey
)/
g_game
.
y_resolution
;
64
float
tmp, n,
f
;
65
GFXGetFrustumVars
(
true
, &tmp, &tmp, &tmp, &tmp, &n, &f );
66
tmp = n+ratio*ratio*ratio*(f-n);
//how far n^3 law
67
if
(distance != 0)
68
LocalPosition
=
LocalPosition
*(tmp/distance)+CamPos;
69
else
70
LocalPosition
= CamPos+CamR*n;
71
CoordinateSelectChange
= 0;
72
}
73
}
74
void
CoordinateSelect::Draw
()
75
{
76
if
(
CoordinateSelectChange
)
77
UpdateMouse
();
78
GFXLoadIdentity
(
MODEL
);
79
80
GFXPushBlendMode
();
81
//VSFileSystem::Fprintf (stderr,"Location: %f %f %f", LocalPosition.i, LocalPosition.j, LocalPosition.k);
82
GFXBlendMode
(
ONE
,
ONE
);
83
LocSelAni
.
SetPosition
(
LocalPosition
);
84
LocSelAni
.
Draw
();
85
GFXPopBlendMode
();
86
}
87
src
gfx
coord_select.cpp
Generated on Fri May 29 2015 23:07:23 for Vegastrike 0.5.1 rc1 by
1.8.4