2025-08-09 03:01:01 -07:00
/* Copyright (C) 2025 Wildfire Games.
2023-12-02 16:30:12 -08:00
* This file is part of 0 A . D .
2009-06-20 09:13:29 -07:00
*
2023-12-02 16:30:12 -08:00
* 0 A . D . is free software : you can redistribute it and / or modify
2009-06-20 09:13:29 -07:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 2 of the License , or
* ( at your option ) any later version .
*
2023-12-02 16:30:12 -08:00
* 0 A . D . is distributed in the hope that it will be useful ,
2009-06-20 09:13:29 -07:00
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2023-12-02 16:30:12 -08:00
* along with 0 A . D . If not , see < http : //www.gnu.org/licenses/>.
2009-06-20 09:13:29 -07:00
*/
2007-06-05 11:35:05 -07:00
# include "precompiled.h"
2006-04-23 16:14:18 -07:00
# include "ScenarioEditor.h"
2025-08-09 12:17:38 -07:00
# include "tools/atlas/AtlasObject/AtlasObject.h"
# include "tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.h"
# include "tools/atlas/AtlasUI/CustomControls/Canvas/Canvas.h"
# include "tools/atlas/AtlasUI/CustomControls/FileHistory/FileHistory.h"
# include "tools/atlas/AtlasUI/CustomControls/HighResTimer/HighResTimer.h"
# include "tools/atlas/AtlasUI/CustomControls/MapDialog/MapDialog.h"
# include "tools/atlas/AtlasUI/General/AtlasWindowCommandProc.h"
# include "tools/atlas/AtlasUI/General/Datafile.h"
# include "tools/atlas/AtlasUI/General/Observable.h"
2025-08-09 03:01:01 -07:00
# include "tools/atlas/AtlasUI/Misc/DLLInterface.h"
2025-08-09 12:17:38 -07:00
# include "tools/atlas/AtlasUI/Misc/KeyMap.h"
# include "tools/atlas/AtlasUI/ScenarioEditor/SectionLayout.h"
# include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/MiscState.h"
# include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h"
# include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/Tools.h"
# include "tools/atlas/GameInterface/MessagePasser.h"
# include "tools/atlas/GameInterface/Messages.h"
# include "tools/atlas/GameInterface/Shareable.h"
# include "tools/atlas/GameInterface/SharedTypes.h"
2025-08-09 03:01:01 -07:00
2025-08-09 12:17:38 -07:00
# include <cstddef>
# include <list>
# include <string>
# include <utility>
# include <wx/busyinfo.h>
# include <wx/chartype.h>
# include <wx/clipbrd.h>
# include <wx/config.h>
# include <wx/dataobj.h>
# include <wx/datetime.h>
# include <wx/debug.h>
# include <wx/ffile.h>
# include <wx/filedlg.h>
# include <wx/filefn.h>
# include <wx/filename.h>
# include <wx/gdicmn.h>
# include <wx/glcanvas.h>
# include <wx/imagbmp.h>
# include <wx/image.h>
# include <wx/imagpng.h>
# include <wx/log.h>
# include <wx/menu.h>
# include <wx/msgdlg.h>
# include <wx/sstream.h>
# include <wx/sysopt.h>
# include <wx/textdlg.h>
# include <wx/toolbar.h>
# include <wx/tooltip.h>
# include <wx/toplevel.h>
# include <wx/translation.h>
# include <wx/utils.h>
# include <wx/xml/xml.h>
2006-04-23 16:14:18 -07:00
2025-08-09 12:17:38 -07:00
class wxInputStream ;
class wxWindow ;
2006-04-23 16:14:18 -07:00
2025-08-17 09:32:51 -07:00
# include <array>
2006-04-23 16:14:18 -07:00
static HighResTimer g_Timer ;
2017-05-15 17:09:16 -07:00
/**
* wxWidgets only registers the double click on mousedown .
*/
static int g_Clicks = 1 ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
using namespace AtlasMessage ;
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
enum TIMER_TYPE
{
TIMER_TOOL ,
TIMER_RENDER
} ;
const int TIMER_TOOL_INTERVAL = 16 ;
const int TIMER_RENDER_INTERVAL = 16 ;
const int TIMER_RENDER_SLOW_INTERVAL = 200 ;
// This records the last activity on the WX side.
double last_wx_user_activity = 0.0 ;
2006-04-23 16:14:18 -07:00
//////////////////////////////////////////////////////////////////////////
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
// GL functions exported from DLL, and called by game (in a separate
// thread to the standard wx one)
2007-01-02 10:11:00 -08:00
ATLASDLLIMPEXP void Atlas_GLSetCurrent ( void * canvas )
2006-04-23 16:14:18 -07:00
{
2011-08-18 16:38:11 -07:00
static_cast < Canvas * > ( canvas ) - > SetCurrent ( ) ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
}
2007-01-02 10:11:00 -08:00
ATLASDLLIMPEXP void Atlas_GLSwapBuffers ( void * canvas )
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
{
2011-08-18 16:38:11 -07:00
static_cast < Canvas * > ( canvas ) - > SwapBuffers ( ) ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
}
2006-04-23 16:14:18 -07:00
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
//////////////////////////////////////////////////////////////////////////
class GameCanvas : public Canvas
{
public :
2007-09-03 16:50:25 -07:00
GameCanvas ( ScenarioEditor & scenarioEditor , wxWindow * parent , int * attribList )
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
: Canvas ( parent , attribList , wxWANTS_CHARS ) ,
2007-09-03 16:50:25 -07:00
m_ScenarioEditor ( scenarioEditor ) , m_MouseState ( NONE ) , m_LastMouseState ( NONE )
2006-04-23 16:14:18 -07:00
{
}
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
private :
2025-08-17 09:32:51 -07:00
void SetScrolling ( int dir , float speed , bool enable )
{
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , dir , enable ? speed : 0.0f ) ) ;
}
2006-04-23 16:14:18 -07:00
bool KeyScroll ( wxKeyEvent & evt , bool enable )
{
2025-08-17 09:32:51 -07:00
static std : : array < bool , 6 > scrolling { } ;
2006-04-23 16:14:18 -07:00
switch ( evt . GetKeyCode ( ) )
{
2025-08-17 09:32:51 -07:00
case ' A ' : case WXK_LEFT : std : : get < 0 > ( scrolling ) = enable ; break ;
case ' D ' : case WXK_RIGHT : std : : get < 1 > ( scrolling ) = enable ; break ;
case ' W ' : case WXK_UP : std : : get < 2 > ( scrolling ) = enable ; break ;
case ' S ' : case WXK_DOWN : std : : get < 3 > ( scrolling ) = enable ; break ;
case ' Q ' : case ' [ ' : std : : get < 4 > ( scrolling ) = enable ; break ;
case ' E ' : case ' ] ' : std : : get < 5 > ( scrolling ) = enable ; break ;
// Modifier keys changing speed and therefore requiring update.
case WXK_SHIFT : case WXK_CONTROL : break ;
2006-04-23 16:14:18 -07:00
default : return false ;
}
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
float speed = 120.f * ScenarioEditor : : GetSpeedModifier ( ) ;
2006-04-23 16:14:18 -07:00
2025-08-17 09:32:51 -07:00
SetScrolling ( eScrollConstantDir : : LEFT , speed , std : : get < 0 > ( scrolling ) ) ;
SetScrolling ( eScrollConstantDir : : RIGHT , speed , std : : get < 1 > ( scrolling ) ) ;
SetScrolling ( eScrollConstantDir : : FORWARDS , speed , std : : get < 2 > ( scrolling ) ) ;
SetScrolling ( eScrollConstantDir : : BACKWARDS , speed , std : : get < 3 > ( scrolling ) ) ;
SetScrolling ( eScrollConstantDir : : CLOCKWISE , speed , std : : get < 4 > ( scrolling ) ) ;
SetScrolling ( eScrollConstantDir : : ANTICLOCKWISE , speed , std : : get < 5 > ( scrolling ) ) ;
return true ;
2006-04-23 16:14:18 -07:00
}
void OnKeyDown ( wxKeyEvent & evt )
{
2011-05-27 14:56:43 -07:00
if ( m_ScenarioEditor . GetToolManager ( ) . GetCurrentTool ( ) - > OnKey ( evt , ITool : : KEY_DOWN ) )
2006-04-23 16:14:18 -07:00
{
// Key event has been handled by the tool, so don't try
// to use it for camera motion too
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
last_wx_user_activity = g_Timer . GetTime ( ) ;
2006-04-23 16:14:18 -07:00
return ;
}
if ( KeyScroll ( evt , true ) )
return ;
2020-08-03 05:23:16 -07:00
POST_MESSAGE ( GuiKeyEvent , ( GetSDLKeyFromWxKeyCode ( evt . GetKeyCode ( ) ) , evt . GetUnicodeKey ( ) , true ) ) ;
2010-06-01 17:36:21 -07:00
2006-04-23 16:14:18 -07:00
evt . Skip ( ) ;
}
void OnKeyUp ( wxKeyEvent & evt )
{
2011-05-27 14:56:43 -07:00
if ( m_ScenarioEditor . GetToolManager ( ) . GetCurrentTool ( ) - > OnKey ( evt , ITool : : KEY_UP ) )
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
{
last_wx_user_activity = g_Timer . GetTime ( ) ;
2006-04-23 16:14:18 -07:00
return ;
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
}
2006-04-23 16:14:18 -07:00
if ( KeyScroll ( evt , false ) )
return ;
2020-08-03 05:23:16 -07:00
POST_MESSAGE ( GuiKeyEvent , ( GetSDLKeyFromWxKeyCode ( evt . GetKeyCode ( ) ) , evt . GetUnicodeKey ( ) , false ) ) ;
2010-06-01 17:36:21 -07:00
2006-04-23 16:14:18 -07:00
evt . Skip ( ) ;
}
void OnChar ( wxKeyEvent & evt )
{
2011-05-27 14:56:43 -07:00
if ( m_ScenarioEditor . GetToolManager ( ) . GetCurrentTool ( ) - > OnKey ( evt , ITool : : KEY_CHAR ) )
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
{
last_wx_user_activity = g_Timer . GetTime ( ) ;
2006-04-23 16:14:18 -07:00
return ;
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
}
2006-04-23 16:14:18 -07:00
2007-09-03 16:50:25 -07:00
// Alt+enter toggles fullscreen
if ( evt . GetKeyCode ( ) = = WXK_RETURN & & wxGetKeyState ( WXK_ALT ) )
{
if ( m_ScenarioEditor . IsFullScreen ( ) )
m_ScenarioEditor . ShowFullScreen ( false ) ;
else
m_ScenarioEditor . ShowFullScreen ( true , wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION ) ;
return ;
}
2011-02-11 15:56:55 -08:00
if ( evt . GetKeyCode ( ) = = ' c ' )
{
POST_MESSAGE ( CameraReset , ( ) ) ;
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
last_wx_user_activity = g_Timer . GetTime ( ) ;
2011-02-11 15:56:55 -08:00
return ;
}
2006-04-23 16:14:18 -07:00
int dir = 0 ;
if ( evt . GetKeyCode ( ) = = ' - ' | | evt . GetKeyCode ( ) = = ' _ ' )
dir = - 1 ;
else if ( evt . GetKeyCode ( ) = = ' + ' | | evt . GetKeyCode ( ) = = ' = ' )
dir = + 1 ;
// TODO: internationalisation (-/_ and +/= don't always share a key)
if ( dir )
{
2010-06-01 17:36:21 -07:00
float speed = 16.f * ScenarioEditor : : GetSpeedModifier ( ) ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
POST_MESSAGE ( SmoothZoom , ( eRenderView : : GAME , speed * dir ) ) ;
2006-04-23 16:14:18 -07:00
}
else
2010-06-01 17:36:21 -07:00
{
2020-08-03 05:23:16 -07:00
// Slight hack: Only pass 'alphanumeric' keys; special keys will generate a KeyDown/KeyUp event instead
if ( evt . GetKeyCode ( ) > = 33 & & evt . GetKeyCode ( ) < = 126 )
2011-02-25 15:53:09 -08:00
POST_MESSAGE ( GuiCharEvent , ( GetSDLKeyFromWxKeyCode ( evt . GetKeyCode ( ) ) , evt . GetUnicodeKey ( ) ) ) ;
2010-06-01 17:36:21 -07:00
2006-04-23 16:14:18 -07:00
evt . Skip ( ) ;
2010-06-01 17:36:21 -07:00
}
2006-04-23 16:14:18 -07:00
}
2010-06-02 03:13:26 -07:00
void OnKillFocus ( wxFocusEvent & evt )
{
// Stop any scrolling, since otherwise we'll carry on forever if
// we lose focus and the KeyUp events go to a different window
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : LEFT , 0.0f ) ) ;
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : RIGHT , 0.0f ) ) ;
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : FORWARDS , 0.0f ) ) ;
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : BACKWARDS , 0.0f ) ) ;
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : CLOCKWISE , 0.0f ) ) ;
POST_MESSAGE ( ScrollConstant , ( eRenderView : : GAME , eScrollConstantDir : : ANTICLOCKWISE , 0.0f ) ) ;
evt . Skip ( ) ;
}
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
virtual void HandleMouseEvent ( wxMouseEvent & evt )
2006-04-23 16:14:18 -07:00
{
// TODO or at least to think about: When using other controls in the
// editor, it's annoying that keyboard/scrollwheel no longer navigate
// around the world until you click on it.
// Setting focus back whenever the mouse moves over the GL window
// feels like a fairly natural solution to me, since I can use
// e.g. brush-editing controls normally, and then move the mouse to
// see the brush outline and magically get given back full control
2012-04-28 20:20:00 -07:00
// of the camera.
if ( evt . Moving ( ) )
2006-04-23 16:14:18 -07:00
SetFocus ( ) ;
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
// Refresh on any mouse event, including just moving the mouse around.
last_wx_user_activity = g_Timer . GetTime ( ) ;
2011-05-27 14:56:43 -07:00
if ( m_ScenarioEditor . GetToolManager ( ) . GetCurrentTool ( ) - > OnMouse ( evt ) )
2006-04-23 16:14:18 -07:00
{
// Mouse event has been handled by the tool, so don't try
// to use it for camera motion too
return ;
}
2006-06-11 00:03:59 -07:00
// Global mouse event handlers (for camera motion)
2006-04-23 16:14:18 -07:00
if ( evt . GetWheelRotation ( ) )
{
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
float speed = 16.f * ScenarioEditor : : GetSpeedModifier ( ) ;
POST_MESSAGE ( SmoothZoom , ( eRenderView : : GAME , evt . GetWheelRotation ( ) * speed / evt . GetWheelDelta ( ) ) ) ;
2006-04-23 16:14:18 -07:00
}
else
{
if ( evt . MiddleIsDown ( ) )
{
2006-06-11 00:03:59 -07:00
if ( wxGetKeyState ( WXK_CONTROL ) | | evt . RightIsDown ( ) )
2006-04-23 16:14:18 -07:00
m_MouseState = ROTATEAROUND ;
else
m_MouseState = SCROLL ;
}
else
m_MouseState = NONE ;
if ( m_MouseState ! = m_LastMouseState )
{
switch ( m_MouseState )
{
case NONE : break ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
case SCROLL : POST_MESSAGE ( Scroll , ( eRenderView : : GAME , eScrollType : : FROM , evt . GetPosition ( ) ) ) ; break ;
case ROTATEAROUND : POST_MESSAGE ( RotateAround , ( eRenderView : : GAME , eRotateAroundType : : FROM , evt . GetPosition ( ) ) ) ; break ;
2006-04-23 16:14:18 -07:00
default : wxFAIL ;
}
m_LastMouseState = m_MouseState ;
}
else if ( evt . Dragging ( ) )
{
switch ( m_MouseState )
{
case NONE : break ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
case SCROLL : POST_MESSAGE ( Scroll , ( eRenderView : : GAME , eScrollType : : TO , evt . GetPosition ( ) ) ) ; break ;
case ROTATEAROUND : POST_MESSAGE ( RotateAround , ( eRenderView : : GAME , eRotateAroundType : : TO , evt . GetPosition ( ) ) ) ; break ;
2006-04-23 16:14:18 -07:00
default : wxFAIL ;
}
}
}
2010-06-01 17:36:21 -07:00
2012-02-06 16:40:55 -08:00
// Button down and double click appear to be mutually exclusive events,
// meaning a second button down event is not sent before a double click
if ( evt . ButtonDown ( ) | | evt . ButtonDClick ( ) )
2017-05-15 17:09:16 -07:00
{
g_Clicks = evt . ButtonDClick ( ) ? 2 : 1 ;
POST_MESSAGE ( GuiMouseButtonEvent , ( evt . GetButton ( ) , true , evt . GetPosition ( ) , g_Clicks ) ) ;
}
2010-06-01 17:36:21 -07:00
else if ( evt . ButtonUp ( ) )
2017-05-15 17:09:16 -07:00
POST_MESSAGE ( GuiMouseButtonEvent , ( evt . GetButton ( ) , false , evt . GetPosition ( ) , g_Clicks ) ) ;
2010-06-01 17:36:21 -07:00
else if ( evt . GetEventType ( ) = = wxEVT_MOTION )
POST_MESSAGE ( GuiMouseMotionEvent , ( evt . GetPosition ( ) ) ) ;
2006-04-23 16:14:18 -07:00
}
enum { NONE , SCROLL , ROTATEAROUND } ;
int m_MouseState , m_LastMouseState ;
2007-09-03 16:50:25 -07:00
ScenarioEditor & m_ScenarioEditor ;
2007-09-02 16:38:58 -07:00
2006-04-23 16:14:18 -07:00
DECLARE_EVENT_TABLE ( ) ;
} ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
BEGIN_EVENT_TABLE ( GameCanvas , Canvas )
EVT_KEY_DOWN ( GameCanvas : : OnKeyDown )
EVT_KEY_UP ( GameCanvas : : OnKeyUp )
EVT_CHAR ( GameCanvas : : OnChar )
2010-06-02 03:13:26 -07:00
EVT_KILL_FOCUS ( GameCanvas : : OnKillFocus )
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
END_EVENT_TABLE ( )
2006-04-23 16:14:18 -07:00
//////////////////////////////////////////////////////////////////////////
enum
{
ID_Quit = 1 ,
2006-07-12 07:49:10 -07:00
2020-08-03 05:23:16 -07:00
ID_New ,
2006-07-12 07:49:10 -07:00
ID_Open ,
ID_Save ,
ID_SaveAs ,
2012-08-07 11:49:46 -07:00
ID_ImportHeightmap ,
2006-04-23 16:14:18 -07:00
2020-08-03 05:23:16 -07:00
ID_Copy ,
ID_Paste ,
2014-11-20 12:52:32 -08:00
2006-04-23 16:14:18 -07:00
ID_Wireframe ,
ID_MessageTrace ,
ID_Screenshot ,
2012-03-05 16:15:48 -08:00
ID_BigScreenshot ,
2007-02-01 18:17:15 -08:00
ID_JavaScript ,
2011-02-11 15:56:55 -08:00
ID_CameraReset ,
2011-04-13 21:01:59 -07:00
ID_DumpState ,
ID_DumpBinaryState ,
2006-04-23 16:14:18 -07:00
2017-08-21 16:32:29 -07:00
ID_Manual ,
ID_ReportBug ,
2006-04-23 16:14:18 -07:00
ID_Toolbar // must be last in the list
} ;
BEGIN_EVENT_TABLE ( ScenarioEditor , wxFrame )
EVT_CLOSE ( ScenarioEditor : : OnClose )
EVT_TIMER ( wxID_ANY , ScenarioEditor : : OnTimer )
2020-08-03 05:23:16 -07:00
EVT_MENU ( ID_New , ScenarioEditor : : OnNew )
2006-07-12 07:49:10 -07:00
EVT_MENU ( ID_Open , ScenarioEditor : : OnOpen )
EVT_MENU ( ID_Save , ScenarioEditor : : OnSave )
EVT_MENU ( ID_SaveAs , ScenarioEditor : : OnSaveAs )
2012-08-07 11:49:46 -07:00
EVT_MENU ( ID_ImportHeightmap , ScenarioEditor : : OnImportHeightmap )
2007-02-09 09:04:55 -08:00
EVT_MENU_RANGE ( wxID_FILE1 , wxID_FILE9 , ScenarioEditor : : OnMRUFile )
2006-07-12 07:49:10 -07:00
2006-04-23 16:14:18 -07:00
EVT_MENU ( ID_Quit , ScenarioEditor : : OnQuit )
EVT_MENU ( wxID_UNDO , ScenarioEditor : : OnUndo )
EVT_MENU ( wxID_REDO , ScenarioEditor : : OnRedo )
2020-08-03 05:23:16 -07:00
EVT_MENU ( ID_Copy , ScenarioEditor : : OnCopy )
EVT_MENU ( ID_Paste , ScenarioEditor : : OnPaste )
2006-04-23 16:14:18 -07:00
EVT_MENU ( ID_Wireframe , ScenarioEditor : : OnWireframe )
EVT_MENU ( ID_MessageTrace , ScenarioEditor : : OnMessageTrace )
EVT_MENU ( ID_Screenshot , ScenarioEditor : : OnScreenshot )
2012-03-05 16:15:48 -08:00
EVT_MENU ( ID_BigScreenshot , ScenarioEditor : : OnScreenshot )
2007-02-01 18:17:15 -08:00
EVT_MENU ( ID_JavaScript , ScenarioEditor : : OnJavaScript )
2011-02-11 15:56:55 -08:00
EVT_MENU ( ID_CameraReset , ScenarioEditor : : OnCameraReset )
2011-04-13 21:01:59 -07:00
EVT_MENU ( ID_DumpState , ScenarioEditor : : OnDumpState )
EVT_MENU ( ID_DumpBinaryState , ScenarioEditor : : OnDumpState )
2006-04-23 16:14:18 -07:00
2017-08-21 16:32:29 -07:00
EVT_MENU ( ID_Manual , ScenarioEditor : : OnHelp )
EVT_MENU ( ID_ReportBug , ScenarioEditor : : OnHelp )
EVT_MENU_OPEN ( ScenarioEditor : : OnMenuOpen )
2014-11-20 12:52:32 -08:00
2006-04-23 16:14:18 -07:00
EVT_IDLE ( ScenarioEditor : : OnIdle )
END_EVENT_TABLE ( )
static AtlasWindowCommandProc g_CommandProc ;
AtlasWindowCommandProc & ScenarioEditor : : GetCommandProc ( ) { return g_CommandProc ; }
2014-02-24 12:22:02 -08:00
ScenarioEditor : : ScenarioEditor ( wxWindow * parent )
2006-07-12 07:49:10 -07:00
: wxFrame ( parent , wxID_ANY , _T ( " " ) , wxDefaultPosition , wxSize ( 1024 , 768 ) )
2014-02-24 12:22:02 -08:00
, m_FileHistory ( _T ( " Scenario Editor " ) )
2011-05-27 14:56:43 -07:00
, m_ObjectSettings ( g_SelectedObjects , AtlasMessage : : eRenderView : : GAME )
2007-09-02 16:38:58 -07:00
, m_ToolManager ( this )
2006-04-23 16:14:18 -07:00
{
// Global application initialisation:
2006-07-12 07:49:10 -07:00
2011-08-18 16:38:11 -07:00
wxImage : : AddHandler ( new wxICOHandler ) ;
2011-09-01 19:27:55 -07:00
/* "osx.openfiledialog.always-show-types: Per default a wxFileDialog with wxFD_OPEN
does not show a types - popup on OSX but allows the selection of files from any of
the supported types . Setting this to 1 shows a wxChoice for selection ( if there
is more than one supported filetype ) . " */
wxSystemOptions : : SetOption ( _T ( " osx.openfiledialog.always-show-types " ) , 1 ) ; // has global effect
2006-07-12 07:49:10 -07:00
// wxLog::SetTraceMask(wxTraceMessages);
2012-04-16 19:43:52 -07:00
g_SelectedTexture = _T ( " grass1_spring " ) ;
g_SelectedTexture . NotifyObservers ( ) ;
2006-07-12 07:49:10 -07:00
SetOpenFilename ( _T ( " " ) ) ;
2010-06-01 17:36:21 -07:00
# if defined(__WXMSW__)
2014-10-17 18:53:06 -07:00
m_Icon = wxIcon ( _T ( " ICON_ScenarioEditor " ) ) ; // load from atlas.rc
2010-06-01 17:36:21 -07:00
# else
{
const wxString relativePath ( _T ( " tools/atlas/icons/ScenarioEditor.ico " ) ) ;
wxFileName filename ( relativePath , wxPATH_UNIX ) ;
filename . MakeAbsolute ( Datafile : : GetDataDirectory ( ) ) ;
2014-10-17 18:53:06 -07:00
m_Icon = wxIcon ( filename . GetFullPath ( ) , wxBITMAP_TYPE_ICO ) ;
2010-06-01 17:36:21 -07:00
}
# endif
2014-10-17 18:53:06 -07:00
SetIcon ( m_Icon ) ;
2006-07-12 07:49:10 -07:00
2006-04-23 16:14:18 -07:00
wxToolTip : : Enable ( true ) ;
2006-07-12 07:49:10 -07:00
2006-04-23 16:14:18 -07:00
wxImage : : AddHandler ( new wxPNGHandler ) ;
2010-10-21 16:44:54 -07:00
//////////////////////////////////////////////////////////////////////////
// Do some early game initialisation:
// (This must happen before constructing the GL canvas.)
POST_MESSAGE ( Init , ( ) ) ;
2010-10-23 12:58:45 -07:00
// Wait for it to finish running Init
qPing qry ;
qry . Post ( ) ;
2006-04-23 16:14:18 -07:00
//////////////////////////////////////////////////////////////////////////
// Menu
wxMenuBar * menuBar = new wxMenuBar ;
SetMenuBar ( menuBar ) ;
wxMenu * menuFile = new wxMenu ;
menuBar - > Append ( menuFile , _ ( " &File " ) ) ;
{
2020-08-03 05:23:16 -07:00
menuFile - > Append ( ID_New , _ ( " &New... " ) ) ;
2006-07-12 07:49:10 -07:00
menuFile - > Append ( ID_Open , _ ( " &Open... " ) ) ;
menuFile - > Append ( ID_Save , _ ( " &Save " ) ) ;
menuFile - > Append ( ID_SaveAs , _ ( " Save &As... " ) ) ;
menuFile - > AppendSeparator ( ) ; //-----------
2012-08-07 11:49:46 -07:00
menuFile - > Append ( ID_ImportHeightmap , _ ( " &Import Heightmap... " ) ) ;
menuFile - > AppendSeparator ( ) ; //-----------
2006-04-23 16:14:18 -07:00
menuFile - > Append ( ID_Quit , _ ( " E&xit " ) ) ;
2007-02-09 09:04:55 -08:00
m_FileHistory . UseMenu ( menuFile ) ; //-------
m_FileHistory . AddFilesToMenu ( ) ;
2006-04-23 16:14:18 -07:00
}
2006-07-12 07:49:10 -07:00
// m_menuItem_Save = menuFile->FindItem(ID_Save); // remember this item, to let it be greyed out
// wxASSERT(m_menuItem_Save);
2006-04-23 16:14:18 -07:00
wxMenu * menuEdit = new wxMenu ;
menuBar - > Append ( menuEdit , _ ( " &Edit " ) ) ;
{
menuEdit - > Append ( wxID_UNDO , _ ( " &Undo " ) ) ;
menuEdit - > Append ( wxID_REDO , _ ( " &Redo " ) ) ;
2020-08-03 05:23:16 -07:00
menuEdit - > AppendSeparator ( ) ;
menuEdit - > Append ( ID_Copy , _ ( " &Copy " ) ) ;
menuEdit - > Enable ( ID_Copy , false ) ;
menuEdit - > Append ( ID_Paste , _ ( " &Paste " ) ) ;
menuEdit - > Enable ( ID_Paste , false ) ;
2006-04-23 16:14:18 -07:00
}
2020-08-03 05:23:16 -07:00
g_SelectedObjects . RegisterObserver ( 0 , & ScenarioEditor : : OnSelectedObjectsChange , this ) ;
2014-11-20 12:52:32 -08:00
2006-04-23 16:14:18 -07:00
GetCommandProc ( ) . SetEditMenu ( menuEdit ) ;
GetCommandProc ( ) . Initialize ( ) ;
wxMenu * menuMisc = new wxMenu ;
menuBar - > Append ( menuMisc , _ ( " &Misc hacks " ) ) ;
{
menuMisc - > AppendCheckItem ( ID_Wireframe , _ ( " &Wireframe " ) ) ;
menuMisc - > AppendCheckItem ( ID_MessageTrace , _ ( " Message debug trace " ) ) ;
menuMisc - > Append ( ID_Screenshot , _ ( " &Screenshot " ) ) ;
2012-03-05 16:15:48 -08:00
menuMisc - > Append ( ID_BigScreenshot , _ ( " Big screenshot " ) ) ;
2007-02-01 18:17:15 -08:00
menuMisc - > Append ( ID_JavaScript , _ ( " &JS console " ) ) ;
2011-02-11 15:56:55 -08:00
menuMisc - > Append ( ID_CameraReset , _ ( " &Reset camera " ) ) ;
2011-03-26 13:17:21 -07:00
2011-04-13 21:01:59 -07:00
wxMenu * menuSS = new wxMenu ;
menuMisc - > AppendSubMenu ( menuSS , _ ( " Si&mulation state " ) ) ;
menuSS - > Append ( ID_DumpState , _ ( " &Dump to disk " ) ) ;
menuSS - > Append ( ID_DumpBinaryState , _ ( " Dump &binary to disk " ) ) ;
2006-04-23 16:14:18 -07:00
}
2017-08-21 16:32:29 -07:00
wxMenu * menuHelp = new wxMenu ;
menuBar - > Append ( menuHelp , _ ( " &Help " ) ) ;
{
2017-08-27 12:32:54 -07:00
wxFileName helpPath ( _T ( " tools/atlas/ " ) ) ;
helpPath . MakeAbsolute ( Datafile : : GetDataDirectory ( ) ) ;
helpPath . SetFullName ( " help.json " ) ;
if ( wxFileExists ( helpPath . GetFullPath ( ) ) )
2017-08-21 16:32:29 -07:00
{
2017-08-27 12:32:54 -07:00
wxFFile helpFile ( helpPath . GetFullPath ( ) ) ;
2017-08-21 16:32:29 -07:00
wxString helpData ;
helpFile . ReadAll ( & helpData ) ;
2024-10-17 10:53:24 -07:00
AtObj data = AtlasObject : : LoadFromJSON ( std : : string { helpData . ToUTF8 ( ) . data ( ) } ) ;
2017-08-28 03:27:36 -07:00
# define ADD_HELP_ITEM(id) \
2017-08-21 16:32:29 -07:00
do { \
if ( ! data [ # id ] . hasContent ( ) ) \
break ; \
if ( ! data [ # id ] [ " title " ] . hasContent ( ) | | ! data [ # id ] [ " url " ] . hasContent ( ) ) \
break ; \
menuHelp - > Append ( ID_ # # id , _ ( wxString ( data [ # id ] [ " title " ] ) ) , _ ( wxString ( data [ # id ] [ " tooltip " ] ) ) ) ; \
m_HelpData . insert ( std : : make_pair ( \
ID_ # # id , \
2019-06-03 13:19:53 -07:00
HelpItem ( wxString : : FromUTF8 ( data [ # id ] [ " title " ] ) , wxString : : FromUTF8 ( data [ # id ] [ " tooltip " ] ) , wxString : : FromUTF8 ( data [ # id ] [ " url " ] ) ) \
2017-08-21 16:32:29 -07:00
) ) ; \
} while ( 0 )
ADD_HELP_ITEM ( Manual ) ;
ADD_HELP_ITEM ( ReportBug ) ;
2017-08-28 03:27:36 -07:00
# undef ADD_HELP_ITEM
2017-08-21 16:32:29 -07:00
}
else
2017-08-27 12:32:54 -07:00
wxLogError ( _ ( " '%ls' does not exist " ) , helpPath . GetFullPath ( ) . c_str ( ) ) ;
2017-08-21 16:32:29 -07:00
}
2012-12-19 19:57:17 -08:00
m_FileHistory . LoadFromSubDir ( * wxConfigBase : : Get ( ) ) ;
2007-02-09 09:04:55 -08:00
2006-07-12 07:49:10 -07:00
m_SectionLayout . SetWindow ( this ) ;
2006-04-23 16:14:18 -07:00
// Toolbar:
2011-08-28 14:10:45 -07:00
// wxOSX/Cocoa 2.9 doesn't seem to like SetToolBar, so we use CreateToolBar which implicitly associates
// the toolbar with the frame, and use OnCreateToolBar to construct our custom toolbar
// (this should be equivalent behavior on all platforms)
2011-08-28 20:50:29 -07:00
CreateToolBar ( wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL , ID_Toolbar ) - > Realize ( ) ;
2006-04-23 16:14:18 -07:00
// Set the default tool to be selected
2007-09-02 16:38:58 -07:00
m_ToolManager . SetCurrentTool ( _T ( " " ) ) ;
2006-04-23 16:14:18 -07:00
// Set up GL canvas:
int glAttribList [ ] = {
WX_GL_RGBA ,
WX_GL_DOUBLEBUFFER ,
WX_GL_DEPTH_SIZE , 24 , // TODO: wx documentation doesn't say 24 is valid
2011-03-18 11:07:18 -07:00
WX_GL_STENCIL_SIZE , 8 ,
2015-03-15 16:59:48 -07:00
WX_GL_BUFFER_SIZE , 24 , // color bits
2006-04-23 16:14:18 -07:00
WX_GL_MIN_ALPHA , 8 , // alpha bits
0
} ;
2007-09-03 16:50:25 -07:00
Canvas * canvas = new GameCanvas ( * this , m_SectionLayout . GetCanvasParent ( ) , glAttribList ) ;
2006-04-23 16:14:18 -07:00
m_SectionLayout . SetCanvas ( canvas ) ;
2006-11-11 20:02:36 -08:00
2007-01-03 07:45:13 -08:00
// Set up sidebars:
2007-06-05 11:16:55 -07:00
m_SectionLayout . Build ( * this ) ;
2007-01-03 07:45:13 -08:00
# if defined(__WXMSW__)
2006-04-23 16:14:18 -07:00
// The canvas' context gets made current on creation; but it can only be
// current for one thread at a time, and it needs to be current for the
// thread that is doing the draw calls, so disable it for this one.
wglMakeCurrent ( NULL , NULL ) ;
2011-08-27 17:28:06 -07:00
# elif defined(__WXGTK__) || defined(__WXOSX__) || defined(__WXMAC__)
// Need to make sure the canvas is realised, so that its context is valid
// this solves the "invalid drawable" error
2007-01-03 07:45:13 -08:00
Show ( true ) ;
2015-02-19 21:46:24 -08:00
Raise ( ) ;
2011-08-27 17:28:06 -07:00
# endif
# ifdef __WXGTK__
// TODO: wxSafeYield causes issues on wxOSX 2.9, is it necessary?
2007-01-03 07:45:13 -08:00
wxSafeYield ( ) ;
# endif
2006-04-23 16:14:18 -07:00
// Send setup messages to game engine:
2021-06-06 08:31:55 -07:00
// We need to set the window HWND for the error dialog instead of iteraing
// through all open windows on Windows.
POST_MESSAGE ( InitAppWindow , ( GetHandle ( ) ) ) ;
2015-02-19 21:46:24 -08:00
POST_MESSAGE ( InitSDL , ( ) ) ;
2011-11-13 04:57:34 -08:00
POST_MESSAGE ( SetCanvas , ( static_cast < wxGLCanvas * > ( canvas ) ,
2021-03-23 08:47:29 -07:00
canvas - > GetClientSize ( ) . GetWidth ( ) * canvas - > GetContentScaleFactor ( ) ,
canvas - > GetClientSize ( ) . GetHeight ( ) * canvas - > GetContentScaleFactor ( ) ) ) ;
2006-04-23 16:14:18 -07:00
2010-10-21 16:44:54 -07:00
POST_MESSAGE ( InitGraphics , ( ) ) ;
2006-04-23 16:14:18 -07:00
canvas - > InitSize ( ) ;
// Start with a blank map (so that the editor can assume there's always
// a valid map loaded)
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
POST_MESSAGE ( LoadMap , ( _T ( " maps/scenarios/_default.xml " ) ) ) ;
2013-02-22 15:20:59 -08:00
POST_MESSAGE ( SimPlay , ( 0.f , false ) ) ;
2011-04-13 21:01:59 -07:00
2011-05-29 08:02:02 -07:00
// Select the initial sidebar (after the map has loaded)
m_SectionLayout . SelectPage ( _T ( " MapSidebar " ) ) ;
2011-04-13 21:01:59 -07:00
// Wait for blank map
qry . Post ( ) ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
POST_MESSAGE ( RenderEnable , ( eRenderView : : GAME ) ) ;
2006-04-23 16:14:18 -07:00
// Set up a timer to make sure tool-updates happen frequently (in addition
// to the idle handler (which makes them happen more frequently if there's nothing
// else to do))
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
m_Timer . SetOwner ( this , TIMER_TOOL ) ;
m_Timer . Start ( TIMER_TOOL_INTERVAL ) ; // in ms
// Set up a timer to trigger engine rendering.
// This is split from the tool timer to enable different framerates.
m_RenderTimer . SetOwner ( this , TIMER_RENDER ) ;
m_RenderTimer . Start ( TIMER_RENDER_INTERVAL ) ; // in ms
2006-04-23 16:14:18 -07:00
}
2011-08-28 14:10:45 -07:00
wxToolBar * ScenarioEditor : : OnCreateToolBar ( long style , wxWindowID id , const wxString & WXUNUSED ( name ) )
{
ToolButtonBar * toolbar = new ToolButtonBar ( m_ToolManager , this , & m_SectionLayout , id , style ) ;
// TODO: configurable small vs large icon images
// (button label; tooltip text; image; internal tool name; section to switch to)
toolbar - > AddToolButton ( _ ( " Default " ) , _ ( " Default " ) , _T ( " default.png " ) , _T ( " " ) , _T ( " " ) ) ;
toolbar - > AddToolButton ( _ ( " Move " ) , _ ( " Move/rotate object " ) , _T ( " moveobject.png " ) , _T ( " TransformObject " ) , _T ( " " ) /*_T("ObjectSidebar")*/ ) ;
toolbar - > AddToolButton ( _ ( " Elevation " ) , _ ( " Alter terrain elevation " ) , _T ( " alterelevation.png " ) , _T ( " AlterElevation " ) , _T ( " " ) /*_T("TerrainSidebar")*/ ) ;
toolbar - > AddToolButton ( _ ( " Smooth " ) , _ ( " Smooth terrain elevation " ) , _T ( " smoothelevation.png " ) , _T ( " SmoothElevation " ) , _T ( " " ) /*_T("TerrainSidebar")*/ ) ;
toolbar - > AddToolButton ( _ ( " Flatten " ) , _ ( " Flatten terrain elevation " ) , _T ( " flattenelevation.png " ) , _T ( " FlattenElevation " ) , _T ( " " ) /*_T("TerrainSidebar")*/ ) ;
toolbar - > AddToolButton ( _ ( " Paint Terrain " ) , _ ( " Paint terrain texture " ) , _T ( " paintterrain.png " ) , _T ( " PaintTerrain " ) , _T ( " " ) /*_T("TerrainSidebar")*/ ) ;
2017-04-30 16:47:16 -07:00
toolbar - > AddToolButton ( _ ( " Move " ) , _ ( " Move cinema path nodes " ) , _T ( " movepath.png " ) , _T ( " TransformPath " ) , _T ( " " ) /*_T("CinemaSidebar")*/ ) ;
2011-08-28 14:10:45 -07:00
return toolbar ;
}
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
float ScenarioEditor : : GetSpeedModifier ( )
{
if ( wxGetKeyState ( WXK_SHIFT ) & & wxGetKeyState ( WXK_CONTROL ) )
return 1.f / 64.f ;
else if ( wxGetKeyState ( WXK_CONTROL ) )
return 1.f / 4.f ;
else if ( wxGetKeyState ( WXK_SHIFT ) )
return 4.f ;
else
return 1.f ;
}
2015-01-08 13:29:27 -08:00
void ScenarioEditor : : OnClose ( wxCloseEvent & event )
2006-04-23 16:14:18 -07:00
{
2020-08-03 05:23:16 -07:00
if ( event . CanVeto ( ) & & GetCommandProc ( ) . IsDirty ( ) )
{
if ( wxMessageBox ( _T ( " You have unsaved changes. Are you sure you want to quit? " ) , _T ( " Discard unsaved changes? " ) , wxICON_QUESTION | wxYES_NO ) ! = wxYES )
{
event . Veto ( ) ;
return ;
}
2015-01-08 13:29:27 -08:00
}
2007-09-02 16:38:58 -07:00
m_ToolManager . SetCurrentTool ( _T ( " " ) ) ;
2006-04-23 16:14:18 -07:00
2012-12-19 19:57:17 -08:00
m_FileHistory . SaveToSubDir ( * wxConfigBase : : Get ( ) ) ;
2007-02-09 09:04:55 -08:00
2021-12-30 08:24:07 -08:00
// We notify all clients that might interact with the game after its
// shutdown to prevent accessing invalid state.
m_SectionLayout . OnShutdown ( ) ;
2006-06-02 22:08:32 -07:00
POST_MESSAGE ( Shutdown , ( ) ) ;
2006-04-23 16:14:18 -07:00
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
qExit ( ) . Post ( ) ;
2006-04-23 16:14:18 -07:00
// blocks until engine has noticed the message, so we won't be
// destroying the GLCanvas while it's still rendering
Destroy ( ) ;
}
2007-09-02 16:38:58 -07:00
static void UpdateTool ( ToolManager & toolManager )
2006-04-23 16:14:18 -07:00
{
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
// TODO: Smoother timing stuff?
static double last = g_Timer . GetTime ( ) ;
double time = g_Timer . GetTime ( ) ;
toolManager . GetCurrentTool ( ) - > OnTick ( time - last ) ;
last = time ;
2006-04-23 16:14:18 -07:00
}
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
void ScenarioEditor : : OnTimer ( wxTimerEvent & evt )
2006-04-23 16:14:18 -07:00
{
Remove the Engine threading when using Atlas
MacOS requires some UI-related API calls to happen on the main thread.
There are several SDL functions that call UI-things, and those were,
since #500 / 08b4d96cf2, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).
It is not the first time we had such issues, as originally the Engine
was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 /
08b4d96cf2, with AtlasUI on the main thread and the Engine in another
thread.
Unfortunately, this still wasn't enough.
This formally unthreads the engine, running it on a wxTimer, to avoid
these issues.
Future work should focus on:
- Further decoupling the simulation from the engine itself, as what
Atlas really needs is a threaded simulation, not a threaded engine.
- Making the simulation itself more threaded
- Making it possible to do tasks asynchronously under Atlas.
Refs #500
Fixes #5470
Differential Revision: https://code.wildfiregames.com/D2752
This was SVN commit r24361.
2020-12-10 01:42:58 -08:00
if ( evt . GetId ( ) = = TIMER_TOOL )
UpdateTool ( m_ToolManager ) ;
else
{
AtlasMessage : : qRenderLoop qryRenderLoop ;
qryRenderLoop . Post ( ) ;
if ( ! qryRenderLoop . wantHighFPS & &
qryRenderLoop . timeSinceActivity > 1.0 & & g_Timer . GetTime ( ) - last_wx_user_activity > 1.0 )
m_RenderTimer . Start ( TIMER_RENDER_SLOW_INTERVAL ) ; // save CPU/GPU when activity is lower.
else
m_RenderTimer . Start ( TIMER_RENDER_INTERVAL ) ;
}
2006-04-23 16:14:18 -07:00
}
void ScenarioEditor : : OnIdle ( wxIdleEvent & )
{
2007-09-02 16:38:58 -07:00
UpdateTool ( m_ToolManager ) ;
2006-04-23 16:14:18 -07:00
}
void ScenarioEditor : : OnQuit ( wxCommandEvent & )
{
Close ( ) ;
}
void ScenarioEditor : : OnUndo ( wxCommandEvent & )
{
GetCommandProc ( ) . Undo ( ) ;
}
void ScenarioEditor : : OnRedo ( wxCommandEvent & )
{
GetCommandProc ( ) . Redo ( ) ;
}
2014-11-20 12:52:32 -08:00
void ScenarioEditor : : OnCopy ( wxCommandEvent & WXUNUSED ( event ) )
{
2020-08-03 05:23:16 -07:00
if ( GetToolManager ( ) . GetCurrentToolName ( ) = = _T ( " TransformObject " ) )
GetToolManager ( ) . GetCurrentTool ( ) - > OnCommand ( _T ( " copy " ) , NULL ) ;
2014-11-20 12:52:32 -08:00
}
void ScenarioEditor : : OnPaste ( wxCommandEvent & WXUNUSED ( event ) )
{
2020-08-03 05:23:16 -07:00
if ( GetToolManager ( ) . GetCurrentToolName ( ) ! = _T ( " TransformObject " ) )
GetToolManager ( ) . SetCurrentTool ( _T ( " TransformObject " ) , NULL ) ;
2014-11-20 12:52:32 -08:00
2020-08-03 05:23:16 -07:00
GetToolManager ( ) . GetCurrentTool ( ) - > OnCommand ( _T ( " paste " ) , NULL ) ;
2014-11-20 12:52:32 -08:00
}
2006-04-23 16:14:18 -07:00
//////////////////////////////////////////////////////////////////////////
2011-04-13 21:01:59 -07:00
void ScenarioEditor : : OnNew ( wxCommandEvent & WXUNUSED ( event ) )
{
2011-05-29 08:02:02 -07:00
if ( wxMessageBox ( _ ( " Discard current map and start blank new map? " ) , _ ( " New map " ) , wxOK | wxCANCEL | wxICON_QUESTION , this ) = = wxOK )
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
OpenFile ( _T ( " " ) , _T ( " maps/scenarios/_default.xml " ) ) ;
2011-04-13 21:01:59 -07:00
}
2011-10-20 16:45:27 -07:00
bool ScenarioEditor : : OpenFile ( const wxString & name , const wxString & filename )
2007-02-09 09:04:55 -08:00
{
2011-10-20 16:45:27 -07:00
wxBusyInfo busy ( _ ( " Loading " ) + name ) ;
2007-02-09 09:04:55 -08:00
wxBusyCursor busyc ;
2011-10-20 16:45:27 -07:00
2021-03-01 15:32:23 -08:00
AtlasMessage : : qVFSFileExists qry ( filename . ToStdWstring ( ) ) ;
2011-10-20 16:45:27 -07:00
qry . Post ( ) ;
if ( ! qry . exists )
return false ;
2016-11-23 06:09:58 -08:00
2007-02-09 09:04:55 -08:00
// Deactivate tools, so they don't carry forwards into the new CWorld
// and crash.
2007-09-02 16:38:58 -07:00
m_ToolManager . SetCurrentTool ( _T ( " " ) ) ;
2007-02-09 09:04:55 -08:00
// TODO: clear the undo buffer, etc
2021-03-01 15:32:23 -08:00
std : : wstring map ( filename . ToStdWstring ( ) ) ;
2007-02-09 09:04:55 -08:00
POST_MESSAGE ( LoadMap , ( map ) ) ;
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
SetOpenFilename ( name ) ;
2007-02-09 09:04:55 -08:00
2011-10-20 16:45:27 -07:00
{ // Wait for it to load, while the wxBusyInfo is telling the user that we're doing that
2019-04-05 05:37:37 -07:00
qPing pingQuery ;
pingQuery . Post ( ) ;
2011-10-20 16:45:27 -07:00
}
2007-02-09 09:04:55 -08:00
2011-05-29 08:02:02 -07:00
NotifyOnMapReload ( ) ;
2011-04-13 21:01:59 -07:00
2015-01-08 13:29:27 -08:00
GetCommandProc ( ) . ClearCommands ( ) ;
2011-10-20 16:45:27 -07:00
return true ;
2007-02-09 09:04:55 -08:00
// TODO: Make this a non-undoable command
}
2006-07-12 07:49:10 -07:00
// TODO (eventually): replace all this file-handling stuff with the Workspace Editor
void ScenarioEditor : : OnOpen ( wxCommandEvent & WXUNUSED ( event ) )
{
2015-01-08 13:29:27 -08:00
if ( DiscardChangesDialog ( ) )
return ;
2014-10-17 18:53:06 -07:00
MapDialog dlg ( NULL , MAPDIALOG_OPEN , m_Icon ) ;
2006-07-12 07:49:10 -07:00
if ( dlg . ShowModal ( ) = = wxID_OK )
2011-10-20 16:45:27 -07:00
{
2018-03-13 13:20:45 -07:00
wxString filePath = dlg . GetSelectedFilePath ( ) ;
if ( ! OpenFile ( filePath , filePath ) )
wxLogError ( _ ( " Map '%ls' does not exist " ) , filePath . c_str ( ) ) ;
2011-10-20 16:45:27 -07:00
}
2006-07-12 07:49:10 -07:00
// TODO: Make this a non-undoable command
}
2012-08-07 11:49:46 -07:00
void ScenarioEditor : : OnImportHeightmap ( wxCommandEvent & WXUNUSED ( event ) )
{
2015-01-08 13:29:27 -08:00
if ( DiscardChangesDialog ( ) )
return ;
2012-08-07 11:49:46 -07:00
wxFileDialog dlg ( NULL , wxFileSelectorPromptStr ,
_T ( " " ) , _T ( " " ) ,
2018-02-05 06:22:16 -08:00
_T ( " Valid image files (*.png, *.bmp)|*.png;*.bmp|All files (*.*)|*.* " ) ,
2012-08-07 11:49:46 -07:00
wxFD_OPEN ) ;
// Set default filter
dlg . SetFilterIndex ( 0 ) ;
if ( dlg . ShowModal ( ) ! = wxID_OK )
return ;
2016-11-23 06:09:58 -08:00
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
OpenFile ( _T ( " " ) , _T ( " maps/scenarios/_default.xml " ) ) ;
2016-11-23 06:09:58 -08:00
2021-03-01 15:32:23 -08:00
std : : wstring image ( dlg . GetPath ( ) . ToStdWstring ( ) ) ;
2012-08-07 11:49:46 -07:00
POST_MESSAGE ( ImportHeightmap , ( image ) ) ;
// TODO: Make this a non-undoable command
}
2007-02-09 09:04:55 -08:00
void ScenarioEditor : : OnMRUFile ( wxCommandEvent & event )
{
2011-04-13 21:01:59 -07:00
wxString filename ( m_FileHistory . GetHistoryFile ( event . GetId ( ) - wxID_FILE1 ) ) ;
2011-10-20 16:45:27 -07:00
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
// Handle old MRU filenames
if ( filename . Mid ( 0 , 5 ) ! = _T ( " maps/ " ) )
{
filename = L " maps/scenarios/ " + filename ;
m_FileHistory . RemoveFileFromHistory ( event . GetId ( ) - wxID_FILE1 ) ;
}
2015-01-08 13:29:27 -08:00
if ( DiscardChangesDialog ( ) )
return ;
2011-10-20 16:45:27 -07:00
if ( ! OpenFile ( filename , filename ) )
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-03 19:29:16 -07:00
{
// Missing or invalid - warn and remove from MRU
2011-10-20 16:45:27 -07:00
wxLogError ( _ ( " Map '%ls' does not exist " ) , filename . c_str ( ) ) ;
2011-04-13 21:01:59 -07:00
m_FileHistory . RemoveFileFromHistory ( event . GetId ( ) - wxID_FILE1 ) ;
}
2007-02-09 09:04:55 -08:00
}
2006-07-12 07:49:10 -07:00
void ScenarioEditor : : OnSave ( wxCommandEvent & event )
{
if ( m_OpenFilename . IsEmpty ( ) )
2011-04-13 21:01:59 -07:00
{
2006-07-12 07:49:10 -07:00
OnSaveAs ( event ) ;
2011-04-13 21:01:59 -07:00
}
2006-07-12 07:49:10 -07:00
else
{
2011-10-20 16:45:27 -07:00
wxBusyInfo busy ( _ ( " Saving " ) + m_OpenFilename ) ;
wxBusyCursor busyc ;
2006-07-12 07:49:10 -07:00
2007-02-04 06:56:38 -08:00
// Deactivate tools, so things like unit previews don't get saved.
// (TODO: Would be nicer to leave the tools active, and just not save
// the preview units.)
2007-09-02 16:38:58 -07:00
m_ToolManager . SetCurrentTool ( _T ( " " ) ) ;
2007-02-04 06:56:38 -08:00
2021-03-01 15:32:23 -08:00
std : : wstring map ( m_OpenFilename . ToStdWstring ( ) ) ;
2006-07-12 07:49:10 -07:00
POST_MESSAGE ( SaveMap , ( map ) ) ;
// Wait for it to finish saving
2011-05-29 08:02:02 -07:00
qPing qry ;
2006-07-12 07:49:10 -07:00
qry . Post ( ) ;
2015-01-08 13:29:27 -08:00
2020-08-03 05:23:16 -07:00
GetCommandProc ( ) . MarkAsSaved ( ) ;
2006-07-12 07:49:10 -07:00
}
}
void ScenarioEditor : : OnSaveAs ( wxCommandEvent & WXUNUSED ( event ) )
{
2014-10-17 18:53:06 -07:00
MapDialog dlg ( NULL , MAPDIALOG_SAVE , m_Icon ) ;
2006-07-12 07:49:10 -07:00
if ( dlg . ShowModal ( ) = = wxID_OK )
{
2018-03-13 13:20:45 -07:00
wxString filePath ( dlg . GetSelectedFilePath ( ) ) ;
wxBusyInfo busy ( _ ( " Saving " ) + filePath ) ;
2011-10-20 16:45:27 -07:00
wxBusyCursor busyc ;
2006-07-12 07:49:10 -07:00
2007-09-02 16:38:58 -07:00
m_ToolManager . SetCurrentTool ( _T ( " " ) ) ;
2007-02-04 06:56:38 -08:00
2021-03-01 15:32:23 -08:00
std : : wstring map ( filePath . ToStdWstring ( ) ) ;
2006-07-12 07:49:10 -07:00
POST_MESSAGE ( SaveMap , ( map ) ) ;
2018-03-13 13:20:45 -07:00
SetOpenFilename ( filePath ) ;
2006-07-12 07:49:10 -07:00
// Wait for it to finish saving
2011-05-29 08:02:02 -07:00
qPing qry ;
2006-07-12 07:49:10 -07:00
qry . Post ( ) ;
2015-01-08 13:29:27 -08:00
2020-08-03 05:23:16 -07:00
GetCommandProc ( ) . MarkAsSaved ( ) ;
2006-07-12 07:49:10 -07:00
}
}
void ScenarioEditor : : SetOpenFilename ( const wxString & filename )
{
SetTitle ( wxString : : Format ( _ ( " Atlas - Scenario Editor - %s " ) ,
2006-11-11 20:02:36 -08:00
( filename . IsEmpty ( ) ? wxString ( _ ( " (untitled) " ) ) : filename ) . c_str ( ) ) ) ;
2006-07-12 07:49:10 -07:00
m_OpenFilename = filename ;
2007-02-09 09:04:55 -08:00
if ( ! filename . IsEmpty ( ) )
m_FileHistory . AddFileToHistory ( filename ) ;
2006-07-12 07:49:10 -07:00
}
2011-05-29 08:02:02 -07:00
void ScenarioEditor : : NotifyOnMapReload ( )
{
m_SectionLayout . OnMapReload ( ) ;
2011-08-22 14:45:39 -07:00
// Notify observers, here so it's independent of individual panels
m_MapSettings . NotifyObservers ( ) ;
2011-05-29 08:02:02 -07:00
}
2015-01-08 13:29:27 -08:00
bool ScenarioEditor : : DiscardChangesDialog ( )
{
return GetCommandProc ( ) . IsDirty ( ) & &
wxMessageBox ( _T ( " You have unsaved changes. Are you sure you want to open another map? " ) , _T ( " Discard unsaved changes? " ) , wxICON_QUESTION | wxYES_NO ) ! = wxYES ;
}
2006-07-12 07:49:10 -07:00
//////////////////////////////////////////////////////////////////////////
2006-04-23 16:14:18 -07:00
void ScenarioEditor : : OnWireframe ( wxCommandEvent & event )
{
POST_MESSAGE ( RenderStyle , ( event . IsChecked ( ) ) ) ;
}
void ScenarioEditor : : OnMessageTrace ( wxCommandEvent & event )
{
POST_MESSAGE ( MessageTrace , ( event . IsChecked ( ) ) ) ;
}
2012-03-05 16:15:48 -08:00
void ScenarioEditor : : OnScreenshot ( wxCommandEvent & event )
2006-04-23 16:14:18 -07:00
{
2012-03-05 16:15:48 -08:00
switch ( event . GetId ( ) )
{
case ID_BigScreenshot :
2022-01-04 10:13:45 -08:00
POST_MESSAGE ( Screenshot , ( true ) ) ;
2012-03-05 16:15:48 -08:00
break ;
case ID_Screenshot :
2022-01-04 10:13:45 -08:00
POST_MESSAGE ( Screenshot , ( false ) ) ;
2012-03-05 16:15:48 -08:00
break ;
}
2006-04-23 16:14:18 -07:00
}
2007-02-01 18:17:15 -08:00
void ScenarioEditor : : OnJavaScript ( wxCommandEvent & WXUNUSED ( event ) )
{
wxString cmd = : : wxGetTextFromUser ( _T ( " " ) , _ ( " JS command " ) , _T ( " " ) , this ) ;
if ( cmd . IsEmpty ( ) )
return ;
2020-11-30 01:03:20 -08:00
POST_MESSAGE ( JavaScript , ( std : : string ( cmd . ToUTF8 ( ) ) ) ) ;
2007-02-01 18:17:15 -08:00
}
2011-02-11 15:56:55 -08:00
void ScenarioEditor : : OnCameraReset ( wxCommandEvent & WXUNUSED ( event ) )
{
POST_MESSAGE ( CameraReset , ( ) ) ;
}
2011-04-13 21:01:59 -07:00
void ScenarioEditor : : OnDumpState ( wxCommandEvent & event )
{
wxDateTime time = wxDateTime : : Now ( ) ;
wxString filename ;
bool doBinary = false ;
switch ( event . GetId ( ) )
{
case ID_DumpState :
filename = wxString : : Format ( _T ( " sim-dump-%d.txt " ) , time . GetTicks ( ) ) ;
break ;
case ID_DumpBinaryState :
doBinary = true ;
filename = wxString : : Format ( _T ( " sim-dump-%d.dat " ) , time . GetTicks ( ) ) ;
break ;
}
qSimStateDebugDump q ( doBinary ) ;
q . Post ( ) ;
2011-07-10 14:00:21 -07:00
std : : wstring dump = * q . dump ;
wxString state ( dump . c_str ( ) ) ;
2011-04-13 21:01:59 -07:00
wxFFile file ( filename . c_str ( ) , _T ( " w " ) ) ;
if ( file . IsOpened ( ) & & ! file . Error ( ) )
{
file . Write ( state ) ;
file . Close ( ) ;
}
else
{
2011-10-20 16:45:27 -07:00
wxLogError ( _ ( " Error writing to file '%ls' " ) , filename . c_str ( ) ) ;
2011-04-13 21:01:59 -07:00
}
}
2014-11-20 12:52:32 -08:00
void ScenarioEditor : : OnSelectedObjectsChange ( const std : : vector < ObjectID > & selectedObjects )
{
2020-08-03 05:23:16 -07:00
GetMenuBar ( ) - > Enable ( ID_Copy , ! selectedObjects . empty ( ) ) ;
2014-11-20 12:52:32 -08:00
}
2017-08-21 16:32:29 -07:00
void ScenarioEditor : : OnHelp ( wxCommandEvent & event )
{
std : : map < int , HelpItem > : : const_iterator it = m_HelpData . find ( event . GetId ( ) ) ;
if ( it = = m_HelpData . end ( ) )
return ;
wxMessageDialog * dialog = new wxMessageDialog (
nullptr , _ ( " Do you want to open ' " + it - > second . m_URL + " '? " ) ,
_ ( " Atlas " ) , wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION
) ;
if ( dialog - > ShowModal ( ) = = wxID_YES )
wxLaunchDefaultBrowser ( it - > second . m_URL ) ;
}
2014-11-20 12:52:32 -08:00
void ScenarioEditor : : OnMenuOpen ( wxMenuEvent & event )
{
2024-12-10 02:29:34 -08:00
// Ignore wxMSW system menu events, see https://gitea.wildfiregames.com/0ad/0ad/issues/5501
2020-08-03 05:23:16 -07:00
const wxMenu * menu = event . GetMenu ( ) ;
if ( ! menu )
return ;
// This could be done far more elegantly if wxMenuItem had changeable id.
wxMenu * pasteMenuItem = NULL ;
menu - > FindItem ( ID_Paste , & pasteMenuItem ) ;
GetMenuBar ( ) - > Enable ( ID_Paste , false ) ;
if ( ! pasteMenuItem )
return ;
wxString content ;
if ( wxTheClipboard - > Open ( ) )
{
if ( wxTheClipboard - > IsSupported ( wxDF_TEXT ) )
{
wxTextDataObject data ;
wxTheClipboard - > GetData ( data ) ;
content = data . GetText ( ) ;
}
wxTheClipboard - > Close ( ) ;
}
if ( content . empty ( ) )
return ;
wxInputStream * is = new wxStringInputStream ( content ) ;
wxXmlDocument doc ;
{
wxLogNull stopComplaining ;
static_cast < void > ( stopComplaining ) ;
if ( ! doc . Load ( * is ) )
return ;
}
wxXmlNode * root = doc . GetRoot ( ) ;
if ( ! root | | root - > GetName ( ) ! = wxT ( " Entities " ) )
return ;
GetMenuBar ( ) - > Enable ( ID_Paste , true ) ;
2014-11-20 12:52:32 -08:00
}
2011-04-13 21:01:59 -07:00
2006-04-23 16:14:18 -07:00
//////////////////////////////////////////////////////////////////////////
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
Position : : Position ( const wxPoint & pt )
2006-04-23 16:14:18 -07:00
: type ( 1 )
{
type1 . x = pt . x ;
type1 . y = pt . y ;
}
2006-05-30 22:27:02 -07:00
//////////////////////////////////////////////////////////////////////////
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
/* Disabled (and should be removed if it turns out to be unnecessary)
- see MessagePasserImpl . cpp for information
2006-05-30 22:27:02 -07:00
2006-04-23 16:14:18 -07:00
static void QueryCallback ( )
{
// If this thread completely blocked on the semaphore inside Query, it would
// never respond to window messages, and the system deadlocks if the
// game tries to display an assertion failure dialog. (See
// WaitForSingleObject on MSDN.)
// So, this callback is called occasionally, and gives wx a change to
// handle messages.
// This is kind of like wxYield, but without the ProcessPendingEvents -
// it's enough to make Windows happy and stop deadlocking, without actually
// calling the event handlers (which could lead to nasty recursion)
2006-05-30 22:27:02 -07:00
// while (wxEventLoop::GetActive()->Pending())
// wxEventLoop::GetActive()->Dispatch();
// Oh dear, we can't use that either - it (at least in wx 2.6.3) still
// processes messages, which causes reentry into various things that we
// don't want to be reentrant. So do it all manually, accepting Windows
// messages and sticking them on a list for later processing (in a custom
// event loop class):
// (TODO: Rethink this entire process on Linux)
// (Alt TODO: Could we make the game never pop up windows (or use the Win32
// GUI in any other way) when it's running under Atlas, so we wouldn't need
// to do any message processing here at all?)
2006-11-11 20:02:36 -08:00
# ifdef _WIN32
2006-05-30 22:27:02 -07:00
AtlasEventLoop * evtLoop = ( AtlasEventLoop * ) wxEventLoop : : GetActive ( ) ;
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
// evtLoop might be NULL, particularly if we're still initialising windows
// and haven't got into the normal event loop yet. But we'd have to process
// messages anyway, to avoid the deadlocks that this is for. So, don't bother
// with that and just crash instead.
// (Maybe it could be solved better by constructing/finding an event loop
// object here and setting it as the global one, assuming it's not overwritten
// later by wx.)
2006-05-30 22:27:02 -07:00
while ( evtLoop - > Pending ( ) )
{
// Based on src/msw/evtloop.cpp's wxEventLoop::Dispatch()
MSG msg ;
BOOL rc = : : GetMessage ( & msg , ( HWND ) NULL , 0 , 0 ) ;
if ( rc = = 0 )
{
// got WM_QUIT
return ;
}
if ( rc = = - 1 )
{
wxLogLastError ( wxT ( " GetMessage " ) ) ;
return ;
}
// Our special bits:
if ( msg . message = = WM_PAINT )
{
// "GetMessage does not remove WM_PAINT messages from the queue.
// The messages remain in the queue until processed."
// So let's process them, to avoid infinite loops...
PAINTSTRUCT paint ;
: : BeginPaint ( msg . hwnd , & paint ) ;
: : EndPaint ( msg . hwnd , & paint ) ;
// Remember that some painting was needed - we'll just repaint
// the whole screen when this is finished.
evtLoop - > NeedsPaint ( ) ;
}
else
{
// Add this message to a queue for later processing. (That's
// probably kind of valid, at least in most cases.)
MSG * pMsg = new MSG ( msg ) ;
evtLoop - > AddMessage ( pMsg ) ;
}
}
2006-11-11 20:02:36 -08:00
# endif
2006-04-23 16:14:18 -07:00
}
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
*/
void QueryMessage : : Post ( )
2006-04-23 16:14:18 -07:00
{
# Added tool for viewing models and animations outside the game.
Atlas: Added ActorViewer. Moved GL canvas into separate class for shared
use. Disabled message-handling callback while blocked on the game, and
stopped creating dialog boxes inside the game thread in order to avoid
deadlocks (hopefully). Support multiple Views (for independent sets of
camera/update/render code). Recalculate territory boundaries when
necessary. Changed default list of animations to match those currently
used by actors.
# Tidied up more code.
Moved some more #includes out of .h files, to minimise unnecessary
compilation.
MathUtil: Deleted unused/unuseful macros (M_PI (use PI instead), M_PI_2
(use PI/2), MAX3, ABS (use abs)).
ObjectManager: Removed some ScEd-specific things.
Unit: Moved creation out of UnitManager, so units can be created without
adding to the manager. Changed CStr8 to the more conventional CStr.
app_hooks: Removed warning for setting multiple times.
win: Restored SEH catcher.
GameSetup, GameView: Removed RenderNoCull, because it doesn't seem to do
what it says it does ("force renderer to load everything") since we're
loading-on-demand most stuff and it doesn't seem especially useful since
we'd prefer to minimise loading times (but feel free to correct me if
I'm wrong). (And because it crashes when things need to be initialised
in a different order, so it's easier to remove than to understand and
fix it.)
PatchRData, Renderer: Work sensibly when there's no game (hence no LOS
manager, water, etc).
LOSManager: Use entity position instead of actor position when possible.
TerritoryManager: Allow delayed recalculations (so Atlas can issue lots
of move+recalculate commands per frame).
Cinematic: Non-pointer wxTimer, so it doesn't leak and doesn't have to
be deleted manually.
This was SVN commit r4261.
2006-08-28 10:36:42 -07:00
// g_MessagePasser->Query(this, &QueryCallback);
g_MessagePasser - > Query ( this , NULL ) ;
2006-04-23 16:14:18 -07:00
}