2006-04-23 16:14:18 -07:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
|
|
#include "MessageHandler.h"
|
|
|
|
|
#include "../CommandProc.h"
|
2007-06-10 12:00:25 -07:00
|
|
|
#include "../SimState.h"
|
2006-09-27 09:54:23 -07:00
|
|
|
#include "../View.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2006-06-09 09:44:16 -07:00
|
|
|
#include "graphics/GameView.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
#include "graphics/Model.h"
|
2007-02-04 06:56:38 -08:00
|
|
|
#include "graphics/ObjectBase.h"
|
# 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
|
|
|
#include "graphics/ObjectEntry.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
#include "graphics/ObjectManager.h"
|
2006-06-09 09:44:16 -07:00
|
|
|
#include "graphics/Terrain.h"
|
|
|
|
|
#include "graphics/Unit.h"
|
|
|
|
|
#include "graphics/UnitManager.h"
|
|
|
|
|
#include "lib/ogl.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
#include "maths/MathUtil.h"
|
2006-06-09 09:44:16 -07:00
|
|
|
#include "maths/Matrix3D.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
#include "ps/CLogger.h"
|
|
|
|
|
#include "ps/Game.h"
|
|
|
|
|
#include "ps/World.h"
|
2006-09-27 19:05:56 -07:00
|
|
|
#include "renderer/Renderer.h"
|
|
|
|
|
#include "renderer/WaterManager.h"
|
2006-07-12 20:29:33 -07:00
|
|
|
#include "simulation/EntityTemplateCollection.h"
|
# 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
|
|
|
#include "simulation/EntityTemplate.h"
|
2006-06-09 09:44:16 -07:00
|
|
|
#include "simulation/Entity.h"
|
|
|
|
|
#include "simulation/EntityManager.h"
|
# 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
|
|
|
#include "simulation/TerritoryManager.h"
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
#define LOG_CATEGORY "editor"
|
|
|
|
|
|
|
|
|
|
namespace AtlasMessage {
|
|
|
|
|
|
2007-01-07 17:56:46 -08:00
|
|
|
namespace
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
bool SortObjectsList(const sObjectsListItem& a, const sObjectsListItem& b)
|
|
|
|
|
{
|
|
|
|
|
return wcscmp(a.name.c_str(), b.name.c_str()) < 0;
|
|
|
|
|
}
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2007-01-07 17:56:46 -08:00
|
|
|
bool IsFloating(const CUnit* unit)
|
|
|
|
|
{
|
|
|
|
|
if (! unit)
|
|
|
|
|
return false;
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2007-01-07 17:56:46 -08:00
|
|
|
if (unit->GetEntity())
|
|
|
|
|
return (unit->GetEntity()->m_base->m_anchorType != L"Ground");
|
|
|
|
|
else
|
|
|
|
|
return unit->GetObject()->m_Base->m_Properties.m_FloatOnWater;
|
|
|
|
|
}
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnitManager& GetUnitManager()
|
|
|
|
|
{
|
|
|
|
|
return g_Game->GetWorld()->GetUnitManager();
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
QUERYHANDLER(GetObjectsList)
|
|
|
|
|
{
|
|
|
|
|
std::vector<sObjectsListItem> objects;
|
2006-09-02 14:20:25 -07:00
|
|
|
|
|
|
|
|
if (CEntityTemplateCollection::IsInitialised())
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
std::vector<CStrW> names;
|
2007-05-02 05:07:08 -07:00
|
|
|
g_EntityTemplateCollection.GetEntityTemplateNames(names);
|
2006-04-23 16:14:18 -07:00
|
|
|
for (std::vector<CStrW>::iterator it = names.begin(); it != names.end(); ++it)
|
|
|
|
|
{
|
2007-05-02 05:07:08 -07:00
|
|
|
//CEntityTemplate* baseent = g_EntityTemplateCollection.GetTemplate(*it);
|
2006-04-23 16:14:18 -07:00
|
|
|
sObjectsListItem e;
|
|
|
|
|
e.id = L"(e) " + *it;
|
|
|
|
|
e.name = *it; //baseent->m_Tag
|
|
|
|
|
e.type = 0;
|
|
|
|
|
objects.push_back(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::vector<CStr> names;
|
2007-01-07 17:56:46 -08:00
|
|
|
//CObjectManager::GetPropObjectNames(names);
|
|
|
|
|
CObjectManager::GetAllObjectNames(names);
|
2006-04-23 16:14:18 -07:00
|
|
|
for (std::vector<CStr>::iterator it = names.begin(); it != names.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
sObjectsListItem e;
|
|
|
|
|
e.id = L"(n) " + CStrW(*it);
|
|
|
|
|
e.name = CStrW(*it).AfterFirst(/*L"props/"*/ L"actors/");
|
|
|
|
|
e.type = 1;
|
|
|
|
|
objects.push_back(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::sort(objects.begin(), objects.end(), SortObjectsList);
|
|
|
|
|
msg->objects = objects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static std::vector<ObjectID> g_Selection;
|
|
|
|
|
void AtlasRenderSelection()
|
|
|
|
|
{
|
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
for (size_t i = 0; i < g_Selection.size(); ++i)
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(g_Selection[i]);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (unit)
|
|
|
|
|
{
|
|
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
2007-05-02 05:07:08 -07:00
|
|
|
unit->GetEntity()->RenderSelectionOutline();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const CBound& bound = unit->GetModel()->GetBounds();
|
|
|
|
|
// Expand bounds by 10% around the centre
|
|
|
|
|
CVector3D centre;
|
|
|
|
|
bound.GetCentre(centre);
|
|
|
|
|
CVector3D a = (bound[0] - centre) * 1.1f + centre;
|
|
|
|
|
CVector3D b = (bound[1] - centre) * 1.1f + centre;
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2007-05-02 05:07:08 -07:00
|
|
|
float h = g_Game->GetWorld()->GetTerrain()->GetExactGroundLevel(centre.X, centre.Z);
|
2006-09-27 19:05:56 -07:00
|
|
|
if (IsFloating(unit))
|
|
|
|
|
h = std::max(h, g_Renderer.GetWaterManager()->m_WaterHeight);
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
glColor3f(0.8f, 0.8f, 0.8f);
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
|
glVertex3f(a.X, h, a.Z);
|
|
|
|
|
glVertex3f(a.X, h, b.Z);
|
|
|
|
|
glVertex3f(b.X, h, b.Z);
|
|
|
|
|
glVertex3f(b.X, h, a.Z);
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MESSAGEHANDLER(SetSelectionPreview)
|
|
|
|
|
{
|
|
|
|
|
g_Selection = *msg->ids;
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-03 19:44:03 -07:00
|
|
|
QUERYHANDLER(GetObjectSettings)
|
|
|
|
|
{
|
2006-09-27 09:54:23 -07:00
|
|
|
CUnit* unit = View::GetView(msg->view)->GetUnit(msg->id);
|
2006-05-03 19:44:03 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
sObjectSettings settings;
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
settings.player = (int)unit->GetPlayerID();
|
2006-05-03 19:44:03 -07:00
|
|
|
|
2006-05-30 22:27:02 -07:00
|
|
|
// Get the unit's possible variants and selected variants
|
2006-08-06 11:41:07 -07:00
|
|
|
std::vector<std::vector<CStr> > groups = unit->GetObject()->m_Base->GetVariantGroups();
|
|
|
|
|
const std::set<CStr>& selections = unit->GetActorSelections();
|
2006-05-30 22:27:02 -07:00
|
|
|
|
|
|
|
|
// Iterate over variant groups
|
2006-08-06 11:41:07 -07:00
|
|
|
std::vector<std::vector<std::wstring> > variantgroups;
|
|
|
|
|
std::set<std::wstring> selections_set;
|
2006-05-30 22:27:02 -07:00
|
|
|
variantgroups.reserve(groups.size());
|
|
|
|
|
for (size_t i = 0; i < groups.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
// Copy variants into output structure
|
|
|
|
|
|
2006-08-06 11:41:07 -07:00
|
|
|
std::vector<std::wstring> group;
|
2006-05-30 22:27:02 -07:00
|
|
|
group.reserve(groups[i].size());
|
|
|
|
|
int choice = -1;
|
|
|
|
|
|
|
|
|
|
for (size_t j = 0; j < groups[i].size(); ++j)
|
|
|
|
|
{
|
2006-08-06 11:41:07 -07:00
|
|
|
group.push_back(CStrW(groups[i][j]));
|
2006-05-30 22:27:02 -07:00
|
|
|
|
|
|
|
|
// Find the first string in 'selections' that matches one of this
|
|
|
|
|
// group's variants
|
|
|
|
|
if (choice == -1)
|
|
|
|
|
if (selections.find(groups[i][j]) != selections.end())
|
|
|
|
|
choice = (int)j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Assuming one of the variants was selected (which it really ought
|
|
|
|
|
// to be), remember that one's name
|
|
|
|
|
if (choice != -1)
|
2006-08-06 11:41:07 -07:00
|
|
|
selections_set.insert(CStrW(groups[i][choice]));
|
2006-05-30 22:27:02 -07:00
|
|
|
|
|
|
|
|
variantgroups.push_back(group);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings.variantgroups = variantgroups;
|
2006-08-06 11:41:07 -07:00
|
|
|
settings.selections = std::vector<std::wstring> (selections_set.begin(), selections_set.end()); // convert set->vector
|
2006-05-03 19:44:03 -07:00
|
|
|
msg->settings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_COMMAND(SetObjectSettings)
|
2006-06-21 15:37:31 -07:00
|
|
|
{
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
size_t m_PlayerOld, m_PlayerNew;
|
2006-08-06 11:41:07 -07:00
|
|
|
std::set<CStr> m_SelectionsOld, m_SelectionsNew;
|
2006-05-03 19:44:03 -07:00
|
|
|
|
|
|
|
|
void Do()
|
|
|
|
|
{
|
2006-09-27 09:54:23 -07:00
|
|
|
CUnit* unit = View::GetView(msg->view)->GetUnit(msg->id);
|
2006-05-03 19:44:03 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
sObjectSettings settings = msg->settings;
|
|
|
|
|
|
|
|
|
|
m_PlayerOld = unit->GetPlayerID();
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
m_PlayerNew = (size_t)settings.player;
|
2006-05-30 22:27:02 -07:00
|
|
|
|
|
|
|
|
m_SelectionsOld = unit->GetActorSelections();
|
|
|
|
|
|
2006-08-06 11:41:07 -07:00
|
|
|
std::vector<std::wstring> selections = *settings.selections;
|
|
|
|
|
for (std::vector<std::wstring>::iterator it = selections.begin(); it != selections.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
m_SelectionsNew.insert(CStr(*it));
|
|
|
|
|
}
|
2006-05-03 19:44:03 -07:00
|
|
|
|
|
|
|
|
Redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Redo()
|
|
|
|
|
{
|
2006-09-02 14:20:25 -07:00
|
|
|
Set(m_PlayerNew, m_SelectionsNew);
|
2006-05-03 19:44:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Undo()
|
2006-09-02 14:20:25 -07:00
|
|
|
{
|
|
|
|
|
Set(m_PlayerOld, m_SelectionsOld);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
void Set(size_t player, const std::set<CStr>& selections)
|
2006-05-03 19:44:03 -07:00
|
|
|
{
|
2006-09-27 09:54:23 -07:00
|
|
|
CUnit* unit = View::GetView(msg->view)->GetUnit(msg->id);
|
2006-05-03 19:44:03 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
2006-09-02 14:20:25 -07:00
|
|
|
unit->SetPlayerID(player);
|
|
|
|
|
|
|
|
|
|
unit->SetActorSelections(selections);
|
|
|
|
|
|
|
|
|
|
if (m_PlayerOld != m_PlayerNew)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
2006-05-03 19:44:03 -07:00
|
|
|
}
|
2006-06-21 15:37:31 -07:00
|
|
|
};
|
2006-05-03 19:44:03 -07:00
|
|
|
END_COMMAND(SetObjectSettings);
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
2008-06-30 10:31:09 -07:00
|
|
|
static size_t g_PreviewUnitID = invalidUnitId;
|
2007-01-16 19:25:20 -08:00
|
|
|
static CStrW g_PreviewUnitName;
|
2006-09-27 19:05:56 -07:00
|
|
|
static bool g_PreviewUnitFloating;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2006-09-27 19:05:56 -07:00
|
|
|
static CVector3D GetUnitPos(const Position& pos, bool floating)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
static CVector3D vec;
|
2006-09-27 19:05:56 -07:00
|
|
|
vec = pos.GetWorldSpace(vec, floating); // if msg->pos is 'Unchanged', use the previous pos
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2007-01-26 18:36:33 -08:00
|
|
|
// Clamp the position to the edges of the world:
|
|
|
|
|
|
|
|
|
|
// Use 'clamp' with a value slightly less than the width, so that converting
|
|
|
|
|
// to integer (rounding towards zero) will put it on the tile inside the edge
|
|
|
|
|
// instead of just outside
|
|
|
|
|
float mapWidth = (g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide()-1)*CELL_SIZE;
|
2007-01-27 04:38:12 -08:00
|
|
|
float delta = 1e-6f; // fraction of map width - must be > FLT_EPSILON
|
2007-01-26 18:36:33 -08:00
|
|
|
|
|
|
|
|
float xOnMap = clamp(vec.X, 0.f, mapWidth * (1.f - delta));
|
|
|
|
|
float zOnMap = clamp(vec.Z, 0.f, mapWidth * (1.f - delta));
|
|
|
|
|
|
2007-05-02 05:07:08 -07:00
|
|
|
// Don't waste time with GetExactGroundLevel unless we've changed
|
2006-04-23 16:14:18 -07:00
|
|
|
if (xOnMap != vec.X || zOnMap != vec.Z)
|
|
|
|
|
{
|
|
|
|
|
vec.X = xOnMap;
|
|
|
|
|
vec.Z = zOnMap;
|
2007-05-02 05:07:08 -07:00
|
|
|
vec.Y = g_Game->GetWorld()->GetTerrain()->GetExactGroundLevel(xOnMap, zOnMap);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return vec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool ParseObjectName(const CStrW& obj, bool& isEntity, CStrW& name)
|
|
|
|
|
{
|
|
|
|
|
if (obj.substr(0, 4) == L"(e) ")
|
|
|
|
|
{
|
|
|
|
|
isEntity = true;
|
|
|
|
|
name = obj.substr(4);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (obj.substr(0, 4) == L"(n) ")
|
|
|
|
|
{
|
|
|
|
|
isEntity = false;
|
|
|
|
|
name = obj.substr(4);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MESSAGEHANDLER(ObjectPreview)
|
|
|
|
|
{
|
2007-01-16 19:25:20 -08:00
|
|
|
CUnit* previewUnit = GetUnitManager().FindByID(g_PreviewUnitID);
|
|
|
|
|
|
|
|
|
|
// Don't recreate the unit unless it's changed
|
|
|
|
|
if (*msg->id != g_PreviewUnitName)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
// Delete old unit
|
2007-01-16 19:25:20 -08:00
|
|
|
if (previewUnit)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2007-01-16 19:25:20 -08:00
|
|
|
GetUnitManager().DeleteUnit(previewUnit);
|
|
|
|
|
previewUnit = NULL;
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
2008-06-30 10:31:09 -07:00
|
|
|
g_PreviewUnitID = invalidUnitId;
|
2007-01-16 19:25:20 -08:00
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
bool isEntity;
|
|
|
|
|
CStrW name;
|
|
|
|
|
if (ParseObjectName(*msg->id, isEntity, name))
|
|
|
|
|
{
|
2006-09-27 19:05:56 -07:00
|
|
|
std::set<CStr> selections; // TODO: get selections from user
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
// Create new unit
|
|
|
|
|
if (isEntity)
|
|
|
|
|
{
|
2007-05-02 05:07:08 -07:00
|
|
|
CEntityTemplate* base = g_EntityTemplateCollection.GetTemplate(name);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (base) // (ignore errors)
|
|
|
|
|
{
|
2007-01-16 19:25:20 -08:00
|
|
|
previewUnit = GetUnitManager().CreateUnit(base->m_actorName, NULL, selections);
|
|
|
|
|
if (previewUnit)
|
|
|
|
|
{
|
|
|
|
|
g_PreviewUnitID = GetUnitManager().GetNewID();
|
|
|
|
|
previewUnit->SetID(g_PreviewUnitID);
|
|
|
|
|
}
|
2006-09-27 19:05:56 -07:00
|
|
|
g_PreviewUnitFloating = (base->m_anchorType != L"Ground");
|
2006-04-23 16:14:18 -07:00
|
|
|
// TODO: variations
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-01-16 19:25:20 -08:00
|
|
|
previewUnit = GetUnitManager().CreateUnit(CStr(name), NULL, selections);
|
|
|
|
|
if (previewUnit)
|
|
|
|
|
{
|
|
|
|
|
g_PreviewUnitID = GetUnitManager().GetNewID();
|
|
|
|
|
previewUnit->SetID(g_PreviewUnitID);
|
|
|
|
|
}
|
|
|
|
|
g_PreviewUnitFloating = IsFloating(previewUnit);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-16 19:25:20 -08:00
|
|
|
g_PreviewUnitName = *msg->id;
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
2007-01-16 19:25:20 -08:00
|
|
|
if (previewUnit)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2006-04-24 22:10:47 -07:00
|
|
|
// Update the unit's position and orientation:
|
|
|
|
|
|
2006-09-27 19:05:56 -07:00
|
|
|
CVector3D pos = GetUnitPos(msg->pos, g_PreviewUnitFloating);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
float s, c;
|
|
|
|
|
|
|
|
|
|
if (msg->usetarget)
|
|
|
|
|
{
|
2006-04-24 22:10:47 -07:00
|
|
|
// Aim from pos towards msg->target
|
# 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
|
|
|
CVector3D target = msg->target->GetWorldSpace(pos.Y);
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector2D dir(target.X-pos.X, target.Z-pos.Z);
|
2007-05-02 05:07:08 -07:00
|
|
|
dir = dir.Normalize();
|
2006-04-23 16:14:18 -07:00
|
|
|
s = dir.x;
|
|
|
|
|
c = dir.y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
s = sin(msg->angle);
|
|
|
|
|
c = cos(msg->angle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMatrix3D m;
|
|
|
|
|
m._11 = -c; m._12 = 0.0f; m._13 = -s; m._14 = pos.X;
|
|
|
|
|
m._21 = 0.0f; m._22 = 1.0f; m._23 = 0.0f; m._24 = pos.Y;
|
|
|
|
|
m._31 = s; m._32 = 0.0f; m._33 = -c; m._34 = pos.Z;
|
|
|
|
|
m._41 = 0.0f; m._42 = 0.0f; m._43 = 0.0f; m._44 = 1.0f;
|
2007-01-16 19:25:20 -08:00
|
|
|
previewUnit->GetModel()->SetTransform(m);
|
2006-04-24 22:10:47 -07:00
|
|
|
|
|
|
|
|
// Update the unit's player colour:
|
2007-01-16 19:25:20 -08:00
|
|
|
previewUnit->SetPlayerID(msg->settings->player);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_COMMAND(CreateObject)
|
2006-06-21 15:37:31 -07:00
|
|
|
{
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector3D m_Pos;
|
|
|
|
|
float m_Angle;
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 11:48:32 -07:00
|
|
|
size_t m_ID;
|
|
|
|
|
size_t m_Player;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
void Do()
|
|
|
|
|
{
|
2006-05-03 19:44:03 -07:00
|
|
|
// Calculate the position/orientation to create this unit with
|
|
|
|
|
|
2006-09-27 19:05:56 -07:00
|
|
|
m_Pos = GetUnitPos(msg->pos, false);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2006-05-03 19:44:03 -07:00
|
|
|
if (msg->usetarget)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2006-05-03 19:44:03 -07:00
|
|
|
// Aim from m_Pos towards msg->target
|
# 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
|
|
|
CVector3D target = msg->target->GetWorldSpace(m_Pos.Y);
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector2D dir(target.X-m_Pos.X, target.Z-m_Pos.Z);
|
|
|
|
|
m_Angle = atan2(dir.x, dir.y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-05-03 19:44:03 -07:00
|
|
|
m_Angle = msg->angle;
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
|
2006-05-03 19:44:03 -07:00
|
|
|
// TODO: variations too
|
|
|
|
|
m_Player = msg->settings->player;
|
|
|
|
|
|
|
|
|
|
// Get a new ID, for future reference to this unit
|
2007-01-07 17:56:46 -08:00
|
|
|
m_ID = GetUnitManager().GetNewID();
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
Redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Redo()
|
|
|
|
|
{
|
|
|
|
|
bool isEntity;
|
|
|
|
|
CStrW name;
|
2006-05-03 19:44:03 -07:00
|
|
|
if (ParseObjectName(*msg->id, isEntity, name))
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2006-09-27 19:05:56 -07:00
|
|
|
std::set<CStr> selections;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
if (isEntity)
|
|
|
|
|
{
|
2007-05-02 05:07:08 -07:00
|
|
|
CEntityTemplate* base = g_EntityTemplateCollection.GetTemplate(name);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! base)
|
2007-12-29 08:22:23 -08:00
|
|
|
LOG(CLogger::Error, LOG_CATEGORY, "Failed to load entity template '%ls'", name.c_str());
|
2006-04-23 16:14:18 -07:00
|
|
|
else
|
|
|
|
|
{
|
2007-05-02 05:07:08 -07:00
|
|
|
HEntity ent = g_EntityManager.Create(base, m_Pos, m_Angle, selections);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
if (! ent)
|
|
|
|
|
{
|
2007-12-29 08:22:23 -08:00
|
|
|
LOG(CLogger::Error, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str());
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else if (! ent->m_actor)
|
|
|
|
|
{
|
|
|
|
|
// We don't want to allow entities with no actors, because
|
|
|
|
|
// they'll be be invisible and will confuse scenario designers
|
2007-12-29 08:22:23 -08:00
|
|
|
LOG(CLogger::Error, LOG_CATEGORY, "Failed to create entity of type '%ls'", name.c_str());
|
2007-05-02 05:07:08 -07:00
|
|
|
ent->Kill();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-09-02 14:20:25 -07:00
|
|
|
ent->m_actor->SetPlayerID(m_Player);
|
2006-04-23 16:14:18 -07:00
|
|
|
ent->m_actor->SetID(m_ID);
|
# 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
|
|
|
|
|
|
|
|
if (ent->m_base->m_isTerritoryCentre)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
2007-01-16 19:25:20 -08:00
|
|
|
|
|
|
|
|
ent->Initialize();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().CreateUnit(CStr(name), NULL, selections);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit)
|
|
|
|
|
{
|
2007-12-29 08:22:23 -08:00
|
|
|
LOG(CLogger::Error, LOG_CATEGORY, "Failed to load nonentity actor '%ls'", name.c_str());
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unit->SetID(m_ID);
|
|
|
|
|
|
|
|
|
|
float s = sin(m_Angle);
|
|
|
|
|
float c = cos(m_Angle);
|
|
|
|
|
|
|
|
|
|
CMatrix3D m;
|
|
|
|
|
m._11 = -c; m._12 = 0.0f; m._13 = -s; m._14 = m_Pos.X;
|
|
|
|
|
m._21 = 0.0f; m._22 = 1.0f; m._23 = 0.0f; m._24 = m_Pos.Y;
|
|
|
|
|
m._31 = s; m._32 = 0.0f; m._33 = -c; m._34 = m_Pos.Z;
|
|
|
|
|
m._41 = 0.0f; m._42 = 0.0f; m._43 = 0.0f; m._44 = 1.0f;
|
|
|
|
|
unit->GetModel()->SetTransform(m);
|
2006-05-03 19:44:03 -07:00
|
|
|
|
|
|
|
|
unit->SetPlayerID(m_Player);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Undo()
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(m_ID);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (unit)
|
|
|
|
|
{
|
|
|
|
|
if (unit->GetEntity())
|
# 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
|
|
|
{
|
|
|
|
|
bool wasTerritoryCentre = unit->GetEntity()->m_base->m_isTerritoryCentre;
|
|
|
|
|
|
2007-05-02 05:07:08 -07:00
|
|
|
unit->GetEntity()->Kill();
|
# 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
|
|
|
|
|
|
|
|
if (wasTerritoryCentre)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
|
|
|
|
}
|
2006-04-23 16:14:18 -07:00
|
|
|
else
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
GetUnitManager().RemoveUnit(unit);
|
2006-04-23 16:14:18 -07:00
|
|
|
delete unit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-06-21 15:37:31 -07:00
|
|
|
};
|
2006-04-23 16:14:18 -07:00
|
|
|
END_COMMAND(CreateObject)
|
|
|
|
|
|
|
|
|
|
|
2006-05-03 19:44:03 -07:00
|
|
|
QUERYHANDLER(PickObject)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
float x, y;
|
|
|
|
|
msg->pos->GetScreenSpace(x, y);
|
|
|
|
|
|
|
|
|
|
CVector3D rayorigin, raydir;
|
|
|
|
|
g_Game->GetView()->GetCamera()->BuildCameraRay((int)x, (int)y, rayorigin, raydir);
|
|
|
|
|
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* target = GetUnitManager().PickUnit(rayorigin, raydir, false);
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
if (target)
|
|
|
|
|
msg->id = target->GetID();
|
|
|
|
|
else
|
2008-06-30 10:31:09 -07:00
|
|
|
msg->id = invalidUnitId;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
|
|
|
|
if (target)
|
|
|
|
|
{
|
2006-05-30 22:27:02 -07:00
|
|
|
// Get screen coordinates of the point on the ground underneath the
|
|
|
|
|
// object's model-centre, so that callers know the offset to use when
|
|
|
|
|
// working out the screen coordinates to move the object to.
|
|
|
|
|
// (TODO: http://trac.0ad.homeip.net/ticket/99)
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector3D centre = target->GetModel()->GetTransform().GetTranslation();
|
2006-09-27 19:05:56 -07:00
|
|
|
|
2007-05-02 05:07:08 -07:00
|
|
|
centre.Y = g_Game->GetWorld()->GetTerrain()->GetExactGroundLevel(centre.X, centre.Z);
|
2006-09-27 19:05:56 -07:00
|
|
|
if (IsFloating(target))
|
|
|
|
|
centre.Y = std::max(centre.Y, g_Renderer.GetWaterManager()->m_WaterHeight);
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
float cx, cy;
|
|
|
|
|
g_Game->GetView()->GetCamera()->GetScreenCoordinates(centre, cx, cy);
|
2006-05-30 22:27:02 -07:00
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
msg->offsetx = (int)(cx - x);
|
|
|
|
|
msg->offsety = (int)(cy - y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg->offsetx = msg->offsety = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_COMMAND(MoveObject)
|
2006-06-21 15:37:31 -07:00
|
|
|
{
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector3D m_PosOld, m_PosNew;
|
|
|
|
|
|
|
|
|
|
void Do()
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
2006-09-27 19:05:56 -07:00
|
|
|
m_PosNew = GetUnitPos(msg->pos, IsFloating(unit));
|
|
|
|
|
|
2006-04-23 16:14:18 -07:00
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
|
|
|
|
m_PosOld = unit->GetEntity()->m_position;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CMatrix3D m = unit->GetModel()->GetTransform();
|
|
|
|
|
m_PosOld = m.GetTranslation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetPos(m_PosNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetPos(CVector3D& pos)
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
|
|
|
|
unit->GetEntity()->m_position = pos;
|
2007-05-02 05:07:08 -07:00
|
|
|
unit->GetEntity()->Teleport();
|
# 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
|
|
|
|
|
|
|
|
if (unit->GetEntity()->m_base->m_isTerritoryCentre)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CMatrix3D m = unit->GetModel()->GetTransform();
|
|
|
|
|
m.Translate(pos - m.GetTranslation());
|
|
|
|
|
unit->GetModel()->SetTransform(m);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Redo()
|
|
|
|
|
{
|
|
|
|
|
SetPos(m_PosNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Undo()
|
|
|
|
|
{
|
|
|
|
|
SetPos(m_PosOld);
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-02 22:08:32 -07:00
|
|
|
void MergeIntoPrevious(cMoveObject* prev)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2006-05-30 22:27:02 -07:00
|
|
|
// TODO: do something valid if prev unit != this unit
|
|
|
|
|
debug_assert(prev->msg->id == msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
prev->m_PosNew = m_PosNew;
|
|
|
|
|
}
|
2006-06-21 15:37:31 -07:00
|
|
|
};
|
2006-04-23 16:14:18 -07:00
|
|
|
END_COMMAND(MoveObject)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_COMMAND(RotateObject)
|
2006-06-21 15:37:31 -07:00
|
|
|
{
|
2006-04-23 16:14:18 -07:00
|
|
|
float m_AngleOld, m_AngleNew;
|
|
|
|
|
CMatrix3D m_TransformOld, m_TransformNew;
|
|
|
|
|
|
|
|
|
|
void Do()
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
2006-05-03 21:14:48 -07:00
|
|
|
m_AngleOld = unit->GetEntity()->m_orientation.Y;
|
2006-05-03 19:44:03 -07:00
|
|
|
if (msg->usetarget)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
CVector3D& pos = unit->GetEntity()->m_position;
|
# 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
|
|
|
CVector3D target = msg->target->GetWorldSpace(pos.Y);
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector2D dir(target.X-pos.X, target.Z-pos.Z);
|
|
|
|
|
m_AngleNew = atan2(dir.x, dir.y);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-05-03 19:44:03 -07:00
|
|
|
m_AngleNew = msg->angle;
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_TransformOld = unit->GetModel()->GetTransform();
|
|
|
|
|
|
|
|
|
|
CVector3D pos = unit->GetModel()->GetTransform().GetTranslation();
|
|
|
|
|
|
|
|
|
|
float s, c;
|
2006-05-03 19:44:03 -07:00
|
|
|
if (msg->usetarget)
|
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
|
|
|
CVector3D target = msg->target->GetWorldSpace(pos.Y);
|
2006-04-23 16:14:18 -07:00
|
|
|
CVector2D dir(target.X-pos.X, target.Z-pos.Z);
|
2007-05-02 05:07:08 -07:00
|
|
|
dir = dir.Normalize();
|
2006-04-23 16:14:18 -07:00
|
|
|
s = dir.x;
|
|
|
|
|
c = dir.y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-05-03 19:44:03 -07:00
|
|
|
s = sinf(msg->angle);
|
|
|
|
|
c = cosf(msg->angle);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
CMatrix3D& m = m_TransformNew;
|
|
|
|
|
m._11 = -c; m._12 = 0.0f; m._13 = -s; m._14 = pos.X;
|
|
|
|
|
m._21 = 0.0f; m._22 = 1.0f; m._23 = 0.0f; m._24 = pos.Y;
|
|
|
|
|
m._31 = s; m._32 = 0.0f; m._33 = -c; m._34 = pos.Z;
|
|
|
|
|
m._41 = 0.0f; m._42 = 0.0f; m._43 = 0.0f; m._44 = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetAngle(m_AngleNew, m_TransformNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetAngle(float angle, CMatrix3D& transform)
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
2006-05-03 21:14:48 -07:00
|
|
|
unit->GetEntity()->m_orientation.Y = angle;
|
2007-05-02 05:07:08 -07:00
|
|
|
unit->GetEntity()->Reorient();
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unit->GetModel()->SetTransform(transform);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Redo()
|
|
|
|
|
{
|
|
|
|
|
SetAngle(m_AngleNew, m_TransformNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Undo()
|
|
|
|
|
{
|
|
|
|
|
SetAngle(m_AngleOld, m_TransformOld);
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-02 22:08:32 -07:00
|
|
|
void MergeIntoPrevious(cRotateObject* prev)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
2006-05-30 22:27:02 -07:00
|
|
|
// TODO: do something valid if prev unit != this unit
|
|
|
|
|
debug_assert(prev->msg->id == msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
prev->m_AngleNew = m_AngleNew;
|
|
|
|
|
prev->m_TransformNew = m_TransformNew;
|
|
|
|
|
}
|
2006-06-21 15:37:31 -07:00
|
|
|
};
|
2006-04-23 16:14:18 -07:00
|
|
|
END_COMMAND(RotateObject)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_COMMAND(DeleteObject)
|
2006-06-21 15:37:31 -07:00
|
|
|
{
|
2007-06-10 12:00:25 -07:00
|
|
|
// These two values are never both non-NULL
|
|
|
|
|
std::auto_ptr<SimState::Entity> m_FrozenEntity;
|
|
|
|
|
std::auto_ptr<SimState::Nonentity> m_FrozenNonentity;
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2006-06-21 15:37:31 -07:00
|
|
|
cDeleteObject()
|
2007-06-10 12:00:25 -07:00
|
|
|
: m_FrozenEntity(NULL), m_FrozenNonentity(NULL)
|
2006-04-23 16:14:18 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Do()
|
|
|
|
|
{
|
|
|
|
|
Redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Redo()
|
|
|
|
|
{
|
2007-01-07 17:56:46 -08:00
|
|
|
CUnit* unit = GetUnitManager().FindByID(msg->id);
|
2006-04-23 16:14:18 -07:00
|
|
|
if (! unit) return;
|
|
|
|
|
|
|
|
|
|
if (unit->GetEntity())
|
|
|
|
|
{
|
2007-06-14 08:42:24 -07:00
|
|
|
bool wasTerritoryCentre = unit->GetEntity()->m_base->m_isTerritoryCentre;
|
|
|
|
|
|
2007-06-10 12:00:25 -07:00
|
|
|
m_FrozenEntity.reset(new SimState::Entity( SimState::Entity::Freeze(unit) ));
|
|
|
|
|
unit->GetEntity()->Kill();
|
2007-06-14 08:42:24 -07:00
|
|
|
|
|
|
|
|
if (wasTerritoryCentre)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
2007-06-10 12:00:25 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_FrozenNonentity.reset(new SimState::Nonentity( SimState::Nonentity::Freeze(unit) ));
|
|
|
|
|
GetUnitManager().RemoveUnit(unit);
|
2006-04-23 16:14:18 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Undo()
|
|
|
|
|
{
|
2007-06-10 12:00:25 -07:00
|
|
|
if (m_FrozenEntity.get())
|
# 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-06-14 08:42:24 -07:00
|
|
|
CEntity* entity = m_FrozenEntity->Thaw();
|
2007-06-10 12:00:25 -07:00
|
|
|
|
2007-06-14 08:42:24 -07:00
|
|
|
if (entity && entity->m_base->m_isTerritoryCentre)
|
|
|
|
|
g_Game->GetWorld()->GetTerritoryManager()->DelayedRecalculate();
|
2006-04-23 16:14:18 -07:00
|
|
|
|
2007-06-10 12:00:25 -07:00
|
|
|
m_FrozenEntity.reset();
|
|
|
|
|
}
|
|
|
|
|
else if (m_FrozenNonentity.get())
|
|
|
|
|
{
|
|
|
|
|
m_FrozenNonentity->Thaw();
|
|
|
|
|
m_FrozenNonentity.reset();
|
# 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
|
|
|
}
|
2006-06-21 15:37:31 -07:00
|
|
|
};
|
2006-04-23 16:14:18 -07:00
|
|
|
END_COMMAND(DeleteObject)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|