Ticket #1022: Atlas-ActorViewer-PlayerColour(1022)-v2.patch
File Atlas-ActorViewer-PlayerColour(1022)-v2.patch, 4.6 KB (added by , 12 years ago) |
---|
-
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp
97 97 98 98 struct ObjectSidebarImpl 99 99 { 100 ObjectSidebarImpl( ) :100 ObjectSidebarImpl(ScenarioEditor& scenarioEditor) : 101 101 m_ObjectListBox(NULL), m_ActorViewerActive(false), 102 m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")), m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f) 102 m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")), 103 m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f), 104 m_ObjectSettings(scenarioEditor.GetObjectSettings()) 103 105 { 104 106 } 105 107 … … 111 113 wxString m_ActorViewerEntity; 112 114 wxString m_ActorViewerAnimation; 113 115 float m_ActorViewerSpeed; 116 ObjectSettings& m_ObjectSettings; 114 117 115 118 void ActorViewerPostToGame() 116 119 { 117 POST_MESSAGE(SetActorViewer, ((std::wstring)m_ActorViewerEntity.wc_str(), (std::wstring)m_ActorViewerAnimation.wc_str(), m_ ActorViewerSpeed, false));120 POST_MESSAGE(SetActorViewer, ((std::wstring)m_ActorViewerEntity.wc_str(), (std::wstring)m_ActorViewerAnimation.wc_str(), m_ObjectSettings.GetPlayerID(), m_ActorViewerSpeed, false)); 118 121 } 119 122 }; 120 123 … … 124 127 wxWindow* bottomBarContainer 125 128 ) 126 129 : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer), 127 p(new ObjectSidebarImpl( ))130 p(new ObjectSidebarImpl(scenarioEditor)) 128 131 { 129 132 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); 130 133 sizer->Add(new wxStaticText(this, wxID_ANY, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER)); -
source/tools/atlas/GameInterface/Messages.h
340 340 MESSAGE(SetActorViewer, 341 341 ((std::wstring, id)) 342 342 ((std::wstring, animation)) 343 ((int, playerId)) 343 344 ((float, speed)) 344 345 ((bool, flushcache)) // true => unload all actor files before starting the preview (because we don't have proper hotloading yet) 345 346 ); -
source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp
153 153 // vfs_reload_changed_files(); 154 154 } 155 155 AtlasView::GetView_Actor()->SetSpeedMultiplier(msg->speed); 156 AtlasView::GetView_Actor()->GetActorViewer().SetActor(*msg->id, *msg->animation );156 AtlasView::GetView_Actor()->GetActorViewer().SetActor(*msg->id, *msg->animation, msg->playerId); 157 157 } 158 158 159 159 ////////////////////////////////////////////////////////////////////////// -
source/tools/atlas/GameInterface/ActorViewer.cpp
48 48 #include "renderer/WaterManager.h" 49 49 #include "scriptinterface/ScriptInterface.h" 50 50 #include "simulation2/Simulation2.h" 51 #include "simulation2/components/ICmpOwnership.h" 51 52 #include "simulation2/components/ICmpPosition.h" 52 53 #include "simulation2/components/ICmpRangeManager.h" 53 54 #include "simulation2/components/ICmpTerrain.h" … … 314 315 m.ObjectManager.UnloadObjects(); 315 316 } 316 317 317 void ActorViewer::SetActor(const CStrW& name, const CStrW& animation )318 void ActorViewer::SetActor(const CStrW& name, const CStrW& animation, int playerId) 318 319 { 319 320 bool needsAnimReload = false; 320 321 … … 428 429 m.UpdatePropList(); 429 430 } 430 431 432 // Unit ownership (sets to the correct player colour) 433 CmpPtr<ICmpOwnership> cmpOwnership(m.Simulation2, m.Entity); 434 if (cmpOwnership) 435 cmpOwnership->SetOwner(playerId); 436 431 437 m.CurrentUnitID = id; 432 438 m.CurrentUnitAnim = animation; 433 439 } -
source/tools/atlas/GameInterface/ActorViewer.h
34 34 35 35 CSimulation2* GetSimulation2(); 36 36 entity_id_t GetEntity(); 37 void SetActor(const CStrW& id, const CStrW& animation );37 void SetActor(const CStrW& id, const CStrW& animation, int playerId=0); 38 38 void UnloadObjects(); 39 39 void SetBackgroundColour(const SColor4ub& colour); 40 40 void SetWalkEnabled(bool enabled);