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>
|
2005-02-25 19:41:53 +00:00
|
|
|
#include <Main/renderer.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();
|
|
|
|
|
2006-03-30 20:37:34 +00:00
|
|
|
// We don't know how to resize the window, so keep the last values
|
|
|
|
// for xsize and ysize, and don't use the one set initially
|
|
|
|
fgSetInt("/sim/startup/xsize",xsize);
|
|
|
|
fgSetInt("/sim/startup/ysize",ysize);
|
|
|
|
|
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") );
|
2004-09-20 13:21:51 +00:00
|
|
|
globals->get_renderer()->resize( xsize, ysize );
|
2001-12-07 22:38:19 +00:00
|
|
|
|
2006-01-29 16:20:31 +00:00
|
|
|
fgSetBool("/sim/signals/reinit", true);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|