2001-04-22 17:00:08 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
#include <plib/pu.h> // plib include
|
|
|
|
|
|
|
|
#include <FDM/flight.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
|
2001-01-19 22:57:24 +00:00
|
|
|
#include <Main/globals.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
#include <Main/fg_init.hxx>
|
2001-04-16 20:31:26 +00:00
|
|
|
#include <Main/fg_props.hxx>
|
2001-12-07 22:38:19 +00:00
|
|
|
#include <Scenery/tilemgr.hxx>
|
|
|
|
#include <Time/light.hxx>
|
2001-01-08 20:55:16 +00:00
|
|
|
|
|
|
|
#include "gui.h"
|
|
|
|
#include "trackball.h"
|
|
|
|
|
|
|
|
// FOR MOUSE VIEW MODE
|
|
|
|
// stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
|
|
|
static float _quat0[4];
|
|
|
|
|
|
|
|
float lastGuiQuat[4];
|
|
|
|
float curGuiQuat[4];
|
|
|
|
|
|
|
|
// To apply our mouse rotation quat to VIEW
|
|
|
|
// sgPreMultMat4( VIEW, GuiQuat_mat);
|
|
|
|
// This is here temporarily should be in views.hxx
|
|
|
|
float GuiQuat_mat[4][4];
|
|
|
|
|
|
|
|
void Quat0( void ) {
|
2001-12-07 22:38:19 +00:00
|
|
|
curGuiQuat[0] = _quat0[0];
|
|
|
|
curGuiQuat[1] = _quat0[1];
|
|
|
|
curGuiQuat[2] = _quat0[2];
|
|
|
|
curGuiQuat[3] = _quat0[3];
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void initMouseQuat(void) {
|
2001-12-07 22:38:19 +00:00
|
|
|
trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
|
|
|
|
Quat0();
|
|
|
|
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void reInit(puObject *cb)
|
|
|
|
{
|
2001-12-11 22:40:14 +00:00
|
|
|
// BusyCursor(0);
|
2001-12-07 22:38:19 +00:00
|
|
|
Quat0();
|
|
|
|
|
2002-01-20 03:52:36 +00:00
|
|
|
static const SGPropertyNode *master_freeze
|
|
|
|
= fgGetNode("/sim/freeze/master");
|
|
|
|
|
|
|
|
bool freeze = master_freeze->getBoolValue();
|
|
|
|
if ( !freeze ) {
|
|
|
|
fgSetBool("/sim/freeze/master", true);
|
|
|
|
}
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
cur_fdm_state->unbind();
|
|
|
|
|
|
|
|
// in case user has changed window size as
|
|
|
|
// restoreInitialState() overwrites these
|
|
|
|
int xsize = fgGetInt("/sim/startup/xsize");
|
|
|
|
int ysize = fgGetInt("/sim/startup/ysize");
|
|
|
|
|
|
|
|
build_rotmatrix(GuiQuat_mat, curGuiQuat);
|
|
|
|
|
|
|
|
globals->restoreInitialState();
|
|
|
|
|
2002-11-18 21:31:33 +00:00
|
|
|
// update our position based on current presets
|
|
|
|
fgInitPosition();
|
|
|
|
|
2002-02-06 23:31:33 +00:00
|
|
|
SGTime *t = globals->get_time_params();
|
|
|
|
delete t;
|
|
|
|
t = fgInitTime();
|
|
|
|
globals->set_time_params( t );
|
|
|
|
|
2001-12-07 22:38:19 +00:00
|
|
|
fgReInitSubsystems();
|
|
|
|
|
2002-12-06 22:29:46 +00:00
|
|
|
globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
fgReshape( xsize, ysize );
|
|
|
|
|
2001-12-11 22:40:14 +00:00
|
|
|
// BusyCursor(1);
|
2001-12-07 22:38:19 +00:00
|
|
|
|
|
|
|
if ( !freeze ) {
|
2002-01-20 03:52:36 +00:00
|
|
|
fgSetBool("/sim/freeze/master", false);
|
2001-12-07 22:38:19 +00:00
|
|
|
}
|
2001-01-08 20:55:16 +00:00
|
|
|
}
|
|
|
|
|