From 23a702c3358f004035877b18b06cb8562e7fc96d Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 20 Mar 2010 16:26:25 +0000 Subject: [PATCH] # OS X build fixes. spidermonkey-tip script fix. GCC 4.2 compatibility. Remove redundant code in extern_libs.lua This was SVN commit r7371. --- build/premake/extern_libs.lua | 2 +- source/graphics/GameView.cpp | 3 +-- source/scripting/ScriptCustomTypes.h | 2 +- source/simulation2/Simulation2.cpp | 15 ++++++++++++--- source/simulation2/Simulation2.h | 3 +++ source/simulation2/components/CCmpPosition.cpp | 10 ++++++++-- .../simulation2/components/tests/test_Position.h | 3 ++- source/simulation2/system/ComponentManager.cpp | 3 ++- source/simulation2/tests/test_Simulation2.h | 3 ++- 9 files changed, 32 insertions(+), 12 deletions(-) diff --git a/build/premake/extern_libs.lua b/build/premake/extern_libs.lua index 1eabb644fe..8c6263c45e 100644 --- a/build/premake/extern_libs.lua +++ b/build/premake/extern_libs.lua @@ -15,7 +15,7 @@ local function add_extern_lib_paths(extern_lib) -- Often, the headers in libraries/ are windows-specific (always, except -- for cxxtest and fcollada). So don't add the include dir unless on -- windows or processing one of those libs. - if OS == "windows" or extern_lib == "cxxtest" or extern_lib == "fcollada" or extern_lib == "valgrind" or extern_lib == "spidermonkey" then + if OS == "windows" or extern_lib == "cxxtest" or extern_lib == "fcollada" or extern_lib == "valgrind" then tinsert(package.includepaths, libraries_dir .. extern_lib .. "/include") -- Insert libs at pos=1 (i.e. the front of the list) so they take -- precedence over system libraries diff --git a/source/graphics/GameView.cpp b/source/graphics/GameView.cpp index 9211f757e0..7ed713c09a 100644 --- a/source/graphics/GameView.cpp +++ b/source/graphics/GameView.cpp @@ -57,7 +57,6 @@ #include "simulation/LOSManager.h" #include "simulation/Projectile.h" #include "simulation2/Simulation2.h" -#include "simulation2/MessageTypes.h" float g_MaxZoomHeight=350.0f; //note: Max terrain height is this minus YMinOffset float g_YMinOffset=15.0f; @@ -394,7 +393,7 @@ void CGameView::EnumerateObjects(const CFrustum& frustum, SceneCollector* c) if (g_UseSimulation2) { PROFILE_START( "submit sim components" ); - m->Game->GetSimulation2()->BroadcastMessage(CMessageRenderSubmit(*c, frustum, m->Culling)); + m->Game->GetSimulation2()->RenderSubmit(*c, frustum, m->Culling); PROFILE_END( "submit sim components" ); return; } diff --git a/source/scripting/ScriptCustomTypes.h b/source/scripting/ScriptCustomTypes.h index f750a33b90..c515c43f46 100644 --- a/source/scripting/ScriptCustomTypes.h +++ b/source/scripting/ScriptCustomTypes.h @@ -38,7 +38,7 @@ public: SColour() { SColourInit( 0.0f, 0.0f, 0.0f, 0.0f ); } SColour( float r_, float g_, float b_ ) { SColourInit( r_, g_, b_, 1.0f ); } SColour( float r_, float g_, float b_, float a_ ) { SColourInit( r_, g_, b_, a_ ); } - SColour( const SColour& other ) { SColourInit( other.r, other.g, other.b, other.a ); } + SColour( const SColour& other ) : CJSObject() { SColourInit( other.r, other.g, other.b, other.a ); } void SColourInit( float r, float g, float b, float a ); SColour &operator = (const SColour &o); diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp index 4d605d1135..9719168b96 100644 --- a/source/simulation2/Simulation2.cpp +++ b/source/simulation2/Simulation2.cpp @@ -146,13 +146,15 @@ void CSimulation2Impl::Update(float frameTime) CFixed_23_8 turnLengthFixed = CFixed_23_8::FromInt(TURN_LENGTH) / 1000; m_DeltaTime -= turnLength; - m_ComponentManager.BroadcastMessage(CMessageTurnStart()); + CMessageTurnStart msgTurnStart; + m_ComponentManager.BroadcastMessage(msgTurnStart); CmpPtr cmpCommandQueue(m_SimContext, SYSTEM_ENTITY); if (!cmpCommandQueue.null()) cmpCommandQueue->ProcessCommands(); - m_ComponentManager.BroadcastMessage(CMessageUpdate(turnLengthFixed)); + CMessageUpdate msgUpdate(turnLengthFixed); + m_ComponentManager.BroadcastMessage(msgUpdate); // Clean up any entities destroyed during the simulation update m_ComponentManager.FlushDestroyedComponents(); @@ -164,7 +166,8 @@ void CSimulation2Impl::Interpolate(float frameTime) // TODO: Use CTurnManager double turnLength = TURN_LENGTH / 1000.0; float offset = clamp(m_DeltaTime / turnLength + 1.0, 0.0, 1.0); - m_ComponentManager.BroadcastMessage(CMessageInterpolate(frameTime, offset)); + CMessageInterpolate msg(frameTime, offset); + m_ComponentManager.BroadcastMessage(msg); } //////////////////////////////////////////////////////////////// @@ -252,6 +255,12 @@ void CSimulation2::Interpolate(float frameTime) m->Interpolate(frameTime); } +void CSimulation2::RenderSubmit(SceneCollector& collector, const CFrustum& frustum, bool culling) +{ + CMessageRenderSubmit msg(collector, frustum, culling); + m->m_ComponentManager.BroadcastMessage(msg); +} + bool CSimulation2::LoadScripts(const VfsPath& path) { return m->LoadScripts(path); diff --git a/source/simulation2/Simulation2.h b/source/simulation2/Simulation2.h index 52202b38b4..61dd1a3fc2 100644 --- a/source/simulation2/Simulation2.h +++ b/source/simulation2/Simulation2.h @@ -33,6 +33,8 @@ class IComponent; class ScriptInterface; class CMessage; class CScriptVal; +class SceneCollector; +class CFrustum; // Hopefully-temporary flag for transition to new simulation system extern bool g_UseSimulation2; @@ -79,6 +81,7 @@ public: void Update(float frameTime); void Interpolate(float frameTime); + void RenderSubmit(SceneCollector& collector, const CFrustum& frustum, bool culling); /** * Construct a new entity and add it to the world. diff --git a/source/simulation2/components/CCmpPosition.cpp b/source/simulation2/components/CCmpPosition.cpp index 2ffd7e871e..5eb1dcef85 100644 --- a/source/simulation2/components/CCmpPosition.cpp +++ b/source/simulation2/components/CCmpPosition.cpp @@ -352,9 +352,15 @@ public: if (m_Dirty) { if (m_InWorld) - context.GetComponentManager().PostMessage(GetEntityId(), CMessagePositionChanged(true, m_X, m_Z, m_RotY)); + { + CMessagePositionChanged msg(true, m_X, m_Z, m_RotY); + context.GetComponentManager().PostMessage(GetEntityId(), msg); + } else - context.GetComponentManager().PostMessage(GetEntityId(), CMessagePositionChanged(false, entity_pos_t(), entity_pos_t(), entity_angle_t())); + { + CMessagePositionChanged msg(false, entity_pos_t(), entity_pos_t(), entity_angle_t()); + context.GetComponentManager().PostMessage(GetEntityId(), msg); + } m_Dirty = false; } diff --git a/source/simulation2/components/tests/test_Position.h b/source/simulation2/components/tests/test_Position.h index 54b90e39e2..773401b459 100644 --- a/source/simulation2/components/tests/test_Position.h +++ b/source/simulation2/components/tests/test_Position.h @@ -86,7 +86,8 @@ public: TS_ASSERT_EQUALS(cmp->GetInterpolatedTransform(1.0f).GetTranslation(), CVector3D(200, 60, 0)); // Latch new position for interpolation - test.HandleMessage(cmp, CMessageTurnStart(), false); + CMessageTurnStart msg; + test.HandleMessage(cmp, msg, false); // Move smoothly to new position cmp->MoveTo(entity_pos_t::FromInt(400), entity_pos_t::FromInt(300)); diff --git a/source/simulation2/system/ComponentManager.cpp b/source/simulation2/system/ComponentManager.cpp index 3e2d9a0073..fca8261d87 100644 --- a/source/simulation2/system/ComponentManager.cpp +++ b/source/simulation2/system/ComponentManager.cpp @@ -590,7 +590,8 @@ void CComponentManager::FlushDestroyedComponents() { entity_id_t ent = *it; - PostMessage(ent, CMessageDestroy(ent)); + CMessageDestroy msg(ent); + PostMessage(ent, msg); // Destroy the components, and remove from m_ComponentsByTypeId: std::map >::iterator iit = m_ComponentsByTypeId.begin(); diff --git a/source/simulation2/tests/test_Simulation2.h b/source/simulation2/tests/test_Simulation2.h index 4d22d7d33f..1e68259d19 100644 --- a/source/simulation2/tests/test_Simulation2.h +++ b/source/simulation2/tests/test_Simulation2.h @@ -120,7 +120,8 @@ public: TS_ASSERT(sim.QueryInterface(ent3, IID_Test2) == NULL); // Messages mustn't get sent to the destroyed components (else we'll crash) - sim.BroadcastMessage(CMessageTurnStart()); + CMessageTurnStart msg; + sim.BroadcastMessage(msg); } void test_hotload_scripts()