RigsofRods
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TerrainEditor.cpp
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "TerrainEditor.h"
23 
24 #include "AppContext.h"
25 #include "Actor.h"
26 #include "CameraManager.h"
27 #include "Console.h"
28 #include "ContentManager.h"
29 #include "GameContext.h"
30 #include "GfxScene.h"
31 #include "InputEngine.h"
32 #include "OgreImGui.h"
33 #include "Terrain.h"
34 #include "TerrainObjectManager.h"
35 #include "TObjFileFormat.h"
36 #include "PlatformUtils.h"
37 
38 using namespace RoR;
39 using namespace Ogre;
40 
41 const TerrainEditorObjectPtr TerrainEditor::TERRAINEDITOROBJECTPTR_NULL; // Dummy value to be returned as const reference.
42 
44 {
45  auto& object_list = App::GetGameContext()->GetTerrain()->getObjectManager()->GetEditorObjects();
46 
47  if (ImGui::IsMouseClicked(2)) // Middle button
48  {
49  ImVec2 mouse_screen = ImGui::GetIO().MousePos / ImGui::GetIO().DisplaySize;
50  Ogre::Ray terrain_editor_mouse_ray = App::GetCameraManager()->GetCamera()->getCameraToViewportRay(mouse_screen.x, mouse_screen.y);
51 
52  float min_dist = std::numeric_limits<float>::max();
53  Vector3 origin = terrain_editor_mouse_ray.getOrigin();
54  Vector3 direction = terrain_editor_mouse_ray.getDirection();
55  for (int i = 0; i < (int)object_list.size(); i++)
56  {
57  Real ray_object_distance = direction.crossProduct(object_list[i]->getPosition() - origin).length();
58  if (ray_object_distance < min_dist)
59  {
60  min_dist = ray_object_distance;
61  this->SetSelectedObjectByID(i);
62  }
63  }
64  }
65  if (m_selected_object_id != -1)
66  {
67  m_last_object_name = object_list[m_selected_object_id]->name;
68  }
69  if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_ENTER_OR_EXIT_TRUCK))
70  {
71  if (m_selected_object_id == -1)
72  {
73  // Select nearest object
75  ? App::GetCameraManager()->GetCameraNode()->getPosition()
77  float min_dist = std::numeric_limits<float>::max();
78  for (int i = 0; i < (int)object_list.size(); i++)
79  {
80  float dist = ref_pos.squaredDistance(object_list[i]->getPosition());
81  if (dist < min_dist)
82  {
83  this->SetSelectedObjectByID(i);
84  min_dist = dist;
85  }
86  }
87  }
88  else
89  {
90  m_selected_object_id = -1;
91  }
92  }
93  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_RESPAWN_LAST_TRUCK) &&
94  m_last_object_name != "")
95  {
97 
98  try
99  {
100  App::GetGameContext()->GetTerrain()->getObjectManager()->LoadTerrainObject(m_last_object_name, pos, Vector3::ZERO, "Console", "");
101 
102  App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_REPLY, _L("Spawned object at position: ") + String("x: ") + TOSTRING(pos.x) + String("z: ") + TOSTRING(pos.z), "world.png");
103  }
104  catch (std::exception& e)
105  {
107  }
108  }
109  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_ENTER_NEXT_TRUCK, 0.25f))
110  {
111  if (object_list.size() > 0)
112  {
113  TerrainEditorObjectID_t i = (m_selected_object_id + 1 + (int)object_list.size()) % object_list.size();
114  this->SetSelectedObjectByID(i);
115  }
116  }
117  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_ENTER_PREVIOUS_TRUCK, 0.25f))
118  {
119  if (object_list.size() > 0)
120  {
121  TerrainEditorObjectID_t i = (m_selected_object_id - 1 + (int)object_list.size()) % object_list.size();
122  this->SetSelectedObjectByID(i);
123  }
124  }
125  if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_RESCUE_TRUCK))
126  {
127  std::string axis = _L("ry");
128  if (m_rotation_axis == 0)
129  {
130  axis = _L("ry");
131  m_rotation_axis = 1;
132  }
133  else if (m_rotation_axis == 1)
134  {
135  axis = _L("rz");
136  m_rotation_axis = 2;
137  }
138  else if (m_rotation_axis == 2)
139  {
140  axis = _L("rx");
141  m_rotation_axis = 0;
142  }
143  std::string ssmsg = _L("Rotating: ") + axis;
145  }
146  if (App::GetInputEngine()->isKeyDownValueBounce(OIS::KC_SPACE))
147  {
148  m_object_tracking = !m_object_tracking;
149  std::string ssmsg = m_object_tracking ? _L("Enabled object tracking") : _L("Disabled object tracking");
151  }
152  if (m_selected_object_id != -1 && App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_RESET_TRUCK))
153  {
154  object_list[m_selected_object_id]->setPosition(object_list[m_selected_object_id]->initial_position);
155  object_list[m_selected_object_id]->setRotation(object_list[m_selected_object_id]->initial_rotation);
156  }
157  if (m_selected_object_id != -1 && App::GetCameraManager()->GetCurrentBehavior() != CameraManager::CAMERA_BEHAVIOR_FREE)
158  {
159  Vector3 translation = Vector3::ZERO;
160  float rotation = 0.0f;
161 
162  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_STEER_LEFT))
163  {
164  rotation += 2.0f;
165  }
166  else if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_STEER_RIGHT))
167  {
168  rotation -= 2.0f;
169  }
170  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_ACCELERATE))
171  {
172  translation.y += 0.5f;
173  }
174  else if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_BRAKE))
175  {
176  translation.y -= 0.5f;
177  }
178  if (App::GetInputEngine()->getEventBoolValue(EV_CHARACTER_FORWARD))
179  {
180  translation.x += 0.5f;
181  }
182  else if (App::GetInputEngine()->getEventBoolValue(EV_CHARACTER_BACKWARDS))
183  {
184  translation.x -= 0.5f;
185  }
186  if (App::GetInputEngine()->getEventBoolValue(EV_CHARACTER_SIDESTEP_RIGHT))
187  {
188  translation.z += 0.5f;
189  }
190  else if (App::GetInputEngine()->getEventBoolValue(EV_CHARACTER_SIDESTEP_LEFT))
191  {
192  translation.z -= 0.5f;
193  }
194 
195  if (translation != Vector3::ZERO || rotation != 0.0f)
196  {
197  float scale = App::GetInputEngine()->isKeyDown(OIS::KC_LMENU) ? 0.1f : 1.0f;
198  scale *= App::GetInputEngine()->isKeyDown(OIS::KC_LSHIFT) ? 3.0f : 1.0f;
199  scale *= App::GetInputEngine()->isKeyDown(OIS::KC_LCONTROL) ? 10.0f : 1.0f;
200 
201  Ogre::Vector3 new_position = object_list[m_selected_object_id]->getPosition();
202  new_position += translation * scale * dt;
203  object_list[m_selected_object_id]->setPosition(new_position);
204 
205  Ogre::Vector3 new_rotation = object_list[m_selected_object_id]->getRotation();
206  new_rotation[m_rotation_axis] += rotation * scale * dt;
207  object_list[m_selected_object_id]->setRotation(new_rotation);
208 
209  if (m_object_tracking)
210  {
212  }
213  }
214  else if (m_object_tracking && App::GetGameContext()->GetPlayerCharacter()->getPosition() != object_list[m_selected_object_id]->getPosition())
215  {
216  object_list[m_selected_object_id]->setPosition(App::GetGameContext()->GetPlayerCharacter()->getPosition());
217  }
218  if (App::GetInputEngine()->getEventBoolValue(EV_COMMON_REMOVE_CURRENT_TRUCK))
219  {
220  App::GetGameContext()->GetTerrain()->getObjectManager()->destroyObject(object_list[m_selected_object_id]->instance_name);
221  }
222  }
223  else
224  {
226  }
227 
228  if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_TOGGLE_TERRAIN_EDITOR))
229  {
231  }
232 }
233 
235 {
237 
238  // Assert on Debug, minimize harm on Release
239  ROR_ASSERT(terrain);
240  if (!terrain)
241  {
242  return;
243  }
244 
245  // If not a project (unzipped), do nothing
246  if (terrain->getCacheEntry()->resource_bundle_type != "FileSystem")
247  {
249  fmt::format("Cannot export terrain editor changes - terrain is not a project"));
250  return;
251  }
252 
253  // Loop over TOBJ files in cache, update editable elements and serialize.
254  for (size_t i = 0; i < terrain->getObjectManager()->GetTobjCache().size(); i++)
255  {
256  // Dump original elements and rebuild them from live data.
257  TObjDocumentPtr tobj = terrain->getObjectManager()->GetTobjCache()[i];
258  tobj->objects.clear();
259  tobj->vehicles.clear();
260  for (TerrainEditorObjectPtr& src : terrain->getObjectManager()->GetEditorObjects())
261  {
262  if (src->tobj_cache_id == i)
263  {
264  if (src->special_object_type == TObjSpecialObject::NONE)
265  {
266  TObjEntry dst;
267  strncpy(dst.odef_name, src->name.c_str(), TObj::STR_LEN);
268  strncpy(dst.instance_name, src->instance_name.c_str(), TObj::STR_LEN);
269  strncpy(dst.type, src->type.c_str(), TObj::STR_LEN);
270  // TBD: reconstruct 'set_default_rendering_distance'.
271  dst.position = src->position;
272  dst.rotation = src->rotation;
273  dst.comments = src->tobj_comments;
274 
275  tobj->objects.push_back(dst);
276  }
277  else
278  {
279  TObjVehicle dst;
280  strncpy(dst.name, src->name.c_str(), TObj::STR_LEN);
281  dst.position = src->position;
282  dst.tobj_rotation = src->rotation;
283  dst.type = src->special_object_type;
284 
285  tobj->vehicles.push_back(dst);
286  }
287  }
288  }
289 
290  try
291  {
292  Ogre::DataStreamPtr stream
293  = Ogre::ResourceGroupManager::getSingleton().createResource(
294  tobj->document_name, terrain->getTerrainFileResourceGroup(), /*overwrite=*/true);
295  TObj::WriteToStream(tobj, stream);
296  }
297  catch (...)
298  {
300  fmt::format("Error saving file '{}' to resource group '{}'",
301  tobj->document_name, terrain->getTerrainFileResourceGroup()), HANDLEGENERICEXCEPTION_CONSOLE);
302  }
303  }
304 }
305 
307 {
308  this->SetSelectedObjectByID(TERRAINEDITOROBJECTID_INVALID);
309 }
310 
312 {
313  // Do nothing if already selected.
314  if (id == m_selected_object_id)
315  {
316  return;
317  }
318 
319  m_selected_object_id = id;
320 
322  {
323  return; // Nothing more to do.
324  }
325 
326  // Notify user
327  auto& object_list = App::GetGameContext()->GetTerrain()->getObjectManager()->GetEditorObjects();
328  String ssmsg = _L("Selected object: [") + TOSTRING(m_selected_object_id) + "/" + TOSTRING(object_list.size()) + "] (" + object_list[m_selected_object_id]->name + ")";
330  if (m_object_tracking)
331  {
332  App::GetGameContext()->GetPlayerCharacter()->setPosition(object_list[m_selected_object_id]->getPosition());
333  }
334 
335  // If setting special object, make sure the actor instance exists, otherwise spawn it again.
336  const TerrainEditorObjectPtr object = this->FetchSelectedObject();
337  ROR_ASSERT(object != TERRAINEDITOROBJECTPTR_NULL);
338  if (object != TERRAINEDITOROBJECTPTR_NULL && object->special_object_type != TObjSpecialObject::NONE)
339  {
341  }
342 }
343 
345 {
346  return m_selected_object_id;
347 }
348 
350 {
351  if (m_selected_object_id == TERRAINEDITOROBJECTID_INVALID)
352  {
353  return TERRAINEDITOROBJECTPTR_NULL;
354  }
355 
356  auto& object_list = App::GetGameContext()->GetTerrain()->getObjectManager()->GetEditorObjects();
357  ROR_ASSERT(m_selected_object_id < (int)object_list.size());
358  if (m_selected_object_id >= (int)object_list.size())
359  {
360  LOG(fmt::format("[RoR|TerrainEditor] INTERNAL ERROR - `m_selected_object_id` '{}' >= `(int)object_list.size()` '{}'",
361  m_selected_object_id, (int)object_list.size()));
362  return TERRAINEDITOROBJECTPTR_NULL;
363  }
364 
365  return object_list[m_selected_object_id];
366 }
367 
368 // -------------------
369 // TerrainEditorObject
370 
371 Ogre::Vector3 const& TerrainEditorObject::getPosition()
372 {
373  return position;
374 }
375 
376 Ogre::Vector3 const& TerrainEditorObject::getRotation()
377 {
378  return rotation;
379 }
380 
382 {
383  ROR_ASSERT(obj->actor_instance_id != ACTORINSTANCEID_INVALID);
384  const ActorPtr& actor = App::GetGameContext()->GetActorManager()->GetActorById(obj->actor_instance_id);
386  if (actor != ActorManager::ACTORPTR_NULL)
387  {
389 
392  req->amr_actor = actor->ar_instance_id;
393  req->amr_softrespawn_position = obj->position;
394  req->amr_softrespawn_rotation = TObjParser::CalcRotation(obj->rotation, rot_yxz);
396  req = nullptr;
397 
398  ActorModifyRequest* fxreq = new ActorModifyRequest();
400  fxreq->amr_actor = actor->ar_instance_id;
402  fxreq = nullptr;
403  }
404 }
405 
406 void TerrainEditorObject::setPosition(Ogre::Vector3 const& pos)
407 {
408  position = pos;
409  if (static_object_node)
410  {
411  static_object_node->setPosition(pos);
412  }
413  else if (special_object_type != TObjSpecialObject::NONE)
414  {
416  }
417 }
418 
419 void TerrainEditorObject::setRotation(Ogre::Vector3 const& rot)
420 {
421  rotation = rot;
422  if (static_object_node)
423  {
424  static_object_node->setOrientation(Quaternion(Degree(rot.x), Vector3::UNIT_X) * Quaternion(Degree(rot.y), Vector3::UNIT_Y) * Quaternion(Degree(rot.z), Vector3::UNIT_Z));
425  static_object_node->pitch(Degree(-90));
426  }
427  else if (special_object_type != TObjSpecialObject::NONE)
428  {
430  }
431 }
432 
433 std::string const& TerrainEditorObject::getName()
434 {
435  return name;
436 }
437 
439 {
440  return instance_name;
441 }
442 
443 std::string const& TerrainEditorObject::getType()
444 {
445  return type;
446 }
447 
449 {
450  return special_object_type;
451 }
452 
454 {
455  special_object_type = type;
456 }
457 
459 {
460  return actor_instance_id;
461 }
462 
464 {
465  actor_instance_id = instance_id;
466 }
ROR_ASSERT
#define ROR_ASSERT(_EXPR)
Definition: Application.h:40
GameContext.h
Game state manager and message-queue provider.
RoR::CacheEntry::resource_bundle_type
std::string resource_bundle_type
Archive type recognized by OGRE resource system: 'FileSystem' or 'Zip'.
Definition: CacheSystem.h:80
RoR::TObjVehicle::type
TObjSpecialObject type
Definition: TObjFileFormat.h:115
RoR::TerrainEditorObject::getPosition
Ogre::Vector3 const & getPosition()
Definition: TerrainEditor.cpp:371
RoR::Character::setPosition
void setPosition(Ogre::Vector3 position)
Definition: Character.cpp:85
RoR::TerrainEditor::UpdateInputEvents
void UpdateInputEvents(float dt)
Definition: TerrainEditor.cpp:43
RoR::MSG_SIM_MODIFY_ACTOR_REQUESTED
@ MSG_SIM_MODIFY_ACTOR_REQUESTED
Payload = RoR::ActorModifyRequest* (owner)
Definition: Application.h:122
RoR::EV_COMMON_RESET_TRUCK
@ EV_COMMON_RESET_TRUCK
reset truck to original starting position
Definition: InputEngine.h:256
RoR::TerrainEditor::SetSelectedObjectByID
void SetSelectedObjectByID(TerrainEditorObjectID_t id)
Definition: TerrainEditor.cpp:311
RoR::Console::CONSOLE_MSGTYPE_TERRN
@ CONSOLE_MSGTYPE_TERRN
Parsing/spawn/simulation messages for terrain.
Definition: Console.h:64
RoR::ActorManager::ACTORPTR_NULL
static const ActorPtr ACTORPTR_NULL
Definition: ActorManager.h:129
RoR::EV_COMMON_ENTER_OR_EXIT_TRUCK
@ EV_COMMON_ENTER_OR_EXIT_TRUCK
enter or exit a truck
Definition: InputEngine.h:228
RoR::TerrainEditorObject::setPosition
void setPosition(Ogre::Vector3 const &pos)
Definition: TerrainEditor.cpp:406
RoR::TObjEntry::comments
std::string comments
Comment line(s) preceding the object-line in the .TOBJ file.
Definition: TObjFileFormat.h:137
RoR::App::GetCameraManager
CameraManager * GetCameraManager()
Definition: Application.cpp:291
RoR::TerrainEditorObject::getRotation
Ogre::Vector3 const & getRotation()
Definition: TerrainEditor.cpp:376
RoR::Actor::ar_instance_id
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
Definition: Actor.h:400
RoR::ActorModifyRequest::Type::REFRESH_VISUALS
@ REFRESH_VISUALS
Forces a synchronous update of visuals from any context - i.e. from terrain editor mode or with sleep...
RoR::TERRAINEDITOROBJECTID_INVALID
static const TerrainEditorObjectID_t TERRAINEDITOROBJECTID_INVALID
Definition: ForwardDeclarations.h:91
ContentManager.h
RoR::Terrain::getTerrainFileResourceGroup
std::string getTerrainFileResourceGroup()
Definition: Terrain.cpp:557
format
Truck file format(technical spec)
RoR::Terrain::getObjectManager
TerrainObjectManager * getObjectManager()
Definition: Terrain.h:79
RoR::TObjSpecialObject
TObjSpecialObject
Definition: Application.h:568
RoR::TerrainEditor::TERRAINEDITOROBJECTPTR_NULL
static const TerrainEditorObjectPtr TERRAINEDITOROBJECTPTR_NULL
Definition: TerrainEditor.h:89
RoR::HandleGenericException
void HandleGenericException(const std::string &from, BitMask_t flags)
Definition: Application.cpp:385
RoR::CameraManager::CAMERA_BEHAVIOR_FREE
@ CAMERA_BEHAVIOR_FREE
Definition: CameraManager.h:52
RoR::GameContext::GetPlayerCharacter
Character * GetPlayerCharacter()
Definition: GameContext.cpp:897
RoR::EV_COMMON_ENTER_PREVIOUS_TRUCK
@ EV_COMMON_ENTER_PREVIOUS_TRUCK
enter previous truck
Definition: InputEngine.h:230
TObjFileFormat.h
Parser and data structures for TOBJ (Terrain Objects) file format.
RoR::TObjEntry::instance_name
char instance_name[TObj::STR_LEN]
Definition: TObjFileFormat.h:134
RoR::EV_CHARACTER_BACKWARDS
@ EV_CHARACTER_BACKWARDS
step backwards with the character
Definition: InputEngine.h:128
CameraManager.h
AppContext.h
System integration layer; inspired by OgreBites::ApplicationContext.
Console.h
RoR::Console::putMessage
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition: Console.cpp:103
TerrainEditorObjectRefreshActorVisual
void TerrainEditorObjectRefreshActorVisual(TerrainEditorObjectPtr obj)
Definition: TerrainEditor.cpp:381
RoR::TerrainObjectManager::destroyObject
void destroyObject(const Ogre::String &instancename)
Definition: TerrainObjectManager.cpp:504
RoR::EV_COMMON_ENTER_NEXT_TRUCK
@ EV_COMMON_ENTER_NEXT_TRUCK
enter next truck
Definition: InputEngine.h:229
RoR::TerrainObjectManager::LoadTerrainObject
bool LoadTerrainObject(const Ogre::String &name, const Ogre::Vector3 &pos, const Ogre::Vector3 &rot, const Ogre::String &instancename, const Ogre::String &type, float rendering_distance=0, bool enable_collisions=true, int scripthandler=-1, bool uniquifyMaterial=false)
Definition: TerrainObjectManager.cpp:600
RoR::TObjEntry::odef_name
char odef_name[TObj::STR_LEN]
Definition: TObjFileFormat.h:135
RoR::CameraManager::GetCameraNode
Ogre::SceneNode * GetCameraNode()
Definition: CameraManager.h:63
TerrainObjectManager.h
OgreImGui.h
RefCountingObjectPtr
Definition: RefCountingObjectPtr.h:24
RoR::Console::CONSOLE_SYSTEM_ERROR
@ CONSOLE_SYSTEM_ERROR
Definition: Console.h:52
Actor.h
RoR::InputEngine::isKeyDown
bool isKeyDown(OIS::KeyCode mod)
Asks OIS directly.
Definition: InputEngine.cpp:1177
RoR::TerrainEditorObject::getType
std::string const & getType()
Definition: TerrainEditor.cpp:443
RoR::Console::CONSOLE_SYSTEM_NOTICE
@ CONSOLE_SYSTEM_NOTICE
Definition: Console.h:51
RoR::ActorModifyRequest::amr_actor
ActorInstanceID_t amr_actor
Definition: SimData.h:875
RoR::EV_TRUCK_STEER_LEFT
@ EV_TRUCK_STEER_LEFT
steer left
Definition: InputEngine.h:359
RoR::TObjEntry
Definition: TObjFileFormat.h:120
RoR::CameraManager::GetCurrentBehavior
CameraBehaviors GetCurrentBehavior() const
Definition: CameraManager.h:62
Script2Game::KC_LSHIFT
enum Script2Game::inputEvents KC_LSHIFT
TOSTRING
#define TOSTRING(x)
Definition: Application.h:56
RoR::CameraManager::GetCamera
Ogre::Camera * GetCamera()
Definition: CameraManager.h:64
RoR::TObjEntry::rotation
Ogre::Vector3 rotation
Definition: TObjFileFormat.h:131
RoR::ActorInstanceID_t
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
Definition: ForwardDeclarations.h:38
RoR::CharacterFactory::Update
void Update(float dt)
Definition: CharacterFactory.cpp:80
RoR::ActorModifyRequest::amr_softrespawn_rotation
Ogre::Quaternion amr_softrespawn_rotation
Rotation to use with SOFT_RESPAWN; use TObjParser::CalcRotation() to calculate quaternion from XYZ li...
Definition: SimData.h:882
RoR::TerrainEditor::ClearSelectedObject
void ClearSelectedObject()
Definition: TerrainEditor.cpp:306
RoR::ActorModifyRequest
Definition: SimData.h:857
RoR::TObjDocumentPtr
std::shared_ptr< TObjDocument > TObjDocumentPtr
Definition: ForwardDeclarations.h:225
RoR::TObjVehicle::tobj_rotation
Ogre::Vector3 tobj_rotation
Original rotation specified in .TOBJ file.
Definition: TObjFileFormat.h:113
RoR::EV_COMMON_RESPAWN_LAST_TRUCK
@ EV_COMMON_RESPAWN_LAST_TRUCK
respawn last truck
Definition: InputEngine.h:232
RoR::TerrainEditorObject::getActorInstanceId
ActorInstanceID_t getActorInstanceId()
Definition: TerrainEditor.cpp:458
RoR::TObj::STR_LEN
const int STR_LEN
Definition: TObjFileFormat.h:37
RoR::EV_CHARACTER_SIDESTEP_RIGHT
@ EV_CHARACTER_SIDESTEP_RIGHT
sidestep to the right
Definition: InputEngine.h:137
RoR::ACTORINSTANCEID_INVALID
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
Definition: ForwardDeclarations.h:39
RoR::GameContext::PushMessage
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
Definition: GameContext.cpp:66
RoR::TerrainObjectManager::GetEditorObjectFlagRotYXZ
bool GetEditorObjectFlagRotYXZ(TerrainEditorObjectPtr const &object)
Definition: TerrainObjectManager.cpp:1020
RoR::GameContext::GetCharacterFactory
CharacterFactory * GetCharacterFactory()
Definition: GameContext.h:151
GfxScene.h
PlatformUtils.h
Platform-specific utilities. We use narrow UTF-8 encoded strings as paths. Inspired by http://utf8eve...
RoR::TerrainEditor::FetchSelectedObject
const TerrainEditorObjectPtr & FetchSelectedObject()
Definition: TerrainEditor.cpp:349
Script2Game::KC_SPACE
enum Script2Game::inputEvents KC_SPACE
RoR::TObjVehicle::position
Ogre::Vector3 position
Definition: TObjFileFormat.h:111
RoR::App::GetConsole
Console * GetConsole()
Definition: Application.cpp:286
RoR::App::GetGameContext
GameContext * GetGameContext()
Definition: Application.cpp:296
RoR::TerrainEditor::GetSelectedObjectID
TerrainEditorObjectID_t GetSelectedObjectID() const
Definition: TerrainEditor.cpp:344
TerrainEditor.h
RoR::Character::getPosition
Ogre::Vector3 getPosition()
Definition: Character.cpp:92
RoR::EV_CHARACTER_FORWARD
@ EV_CHARACTER_FORWARD
step forward with the character
Definition: InputEngine.h:129
RoR::TerrainObjectManager::GetEditorObjects
TerrainEditorObjectPtrVec & GetEditorObjects()
Definition: TerrainObjectManager.h:66
RoR::EV_COMMON_TOGGLE_TERRAIN_EDITOR
@ EV_COMMON_TOGGLE_TERRAIN_EDITOR
toggle terrain editor
Definition: InputEngine.h:266
RoR::ActorModifyRequest::amr_softrespawn_position
Ogre::Vector3 amr_softrespawn_position
Position to use with SOFT_RESPAWN.
Definition: SimData.h:881
RoR::TObjEntry::type
char type[TObj::STR_LEN]
Definition: TObjFileFormat.h:133
RoR::Console::CONSOLE_SYSTEM_REPLY
@ CONSOLE_SYSTEM_REPLY
Success.
Definition: Console.h:54
RoR::TerrainEditor::WriteOutputFile
void WriteOutputFile()
Definition: TerrainEditor.cpp:234
RoR::TObjParser::CalcRotation
static Ogre::Quaternion CalcRotation(Ogre::Vector3 const &rot, bool rot_yxz)
Definition: TObjFileFormat.cpp:396
RoR::EV_TRUCK_ACCELERATE
@ EV_TRUCK_ACCELERATE
accelerate the truck
Definition: InputEngine.h:296
RoR::TerrainEditorObject::getInstanceName
std::string const & getInstanceName()
Definition: TerrainEditor.cpp:438
RoR::TerrainEditorObjectID_t
int TerrainEditorObjectID_t
Offset into RoR::TerrainObjectManager::m_editor_objects, use RoR::TERRAINEDITOROBJECTID_INVALID as em...
Definition: ForwardDeclarations.h:90
RoR::ActorModifyRequest::Type::SOFT_RESPAWN
@ SOFT_RESPAWN
Like hard reset, but positions the actor like spawn process does - using the relative positions from ...
RoR::TerrainEditorObject::getSpecialObjectType
TObjSpecialObject getSpecialObjectType()
Definition: TerrainEditor.cpp:448
RoR::Message
Unified game event system - all requests and state changes are reported using a message.
Definition: GameContext.h:51
_L
#define _L
Definition: ErrorUtils.cpp:35
RoR::TerrainEditorObject::getName
std::string const & getName()
Definition: TerrainEditor.cpp:433
RoR::EV_TRUCK_STEER_RIGHT
@ EV_TRUCK_STEER_RIGHT
steer right
Definition: InputEngine.h:360
RoR::TObj::WriteToStream
void WriteToStream(TObjDocumentPtr doc, Ogre::DataStreamPtr stream)
Definition: TObjFileFormat.cpp:475
RoR::TObjVehicle::name
char name[TObj::STR_LEN]
Definition: TObjFileFormat.h:114
RoR::MSG_EDI_LEAVE_TERRN_EDITOR_REQUESTED
@ MSG_EDI_LEAVE_TERRN_EDITOR_REQUESTED
Definition: Application.h:151
RoR::Terrain::getCacheEntry
CacheEntryPtr getCacheEntry()
Definition: Terrain.cpp:585
RoR::App::GetInputEngine
InputEngine * GetInputEngine()
Definition: Application.cpp:287
RoR::EV_CHARACTER_SIDESTEP_LEFT
@ EV_CHARACTER_SIDESTEP_LEFT
sidestep to the left
Definition: InputEngine.h:136
Terrain.h
InputEngine.h
Handles controller inputs from player. Defines input events and binding mechanism,...
Ogre
Definition: ExtinguishableFireAffector.cpp:35
RoR::Console::CONSOLE_SYSTEM_WARNING
@ CONSOLE_SYSTEM_WARNING
Definition: Console.h:53
RoR::TObjSpecialObject::NONE
@ NONE
RoR::TObjEntry::position
Ogre::Vector3 position
Definition: TObjFileFormat.h:130
RoR::Console::CONSOLE_MSGTYPE_INFO
@ CONSOLE_MSGTYPE_INFO
Generic message.
Definition: Console.h:60
RoR::TerrainEditorObject::setRotation
void setRotation(Ogre::Vector3 const &rot)
Definition: TerrainEditor.cpp:419
RoR::TObjVehicle
Definition: TObjFileFormat.h:109
RoR::ActorModifyRequest::amr_type
Type amr_type
Definition: SimData.h:876
RoR::TerrainEditorObject::setActorInstanceId
void setActorInstanceId(ActorInstanceID_t instance_id)
Definition: TerrainEditor.cpp:463
RoR
Definition: AppContext.h:36
RoR::ActorManager::GetActorById
const ActorPtr & GetActorById(ActorInstanceID_t actor_id)
Definition: ActorManager.cpp:1139
RoR::EV_COMMON_REMOVE_CURRENT_TRUCK
@ EV_COMMON_REMOVE_CURRENT_TRUCK
remove current truck
Definition: InputEngine.h:231
RoR::TerrainObjectManager::GetTobjCache
std::vector< TObjDocumentPtr > & GetTobjCache()
Definition: TerrainObjectManager.h:67
RoR::EV_COMMON_RESCUE_TRUCK
@ EV_COMMON_RESCUE_TRUCK
teleport to rescue truck
Definition: InputEngine.h:255
RoR::GameContext::GetActorManager
ActorManager * GetActorManager()
Definition: GameContext.h:127
RoR::EV_TRUCK_BRAKE
@ EV_TRUCK_BRAKE
brake
Definition: InputEngine.h:305
RoR::TerrainEditorObject::setSpecialObjectType
void setSpecialObjectType(TObjSpecialObject type)
Definition: TerrainEditor.cpp:453
RoR::HANDLEGENERICEXCEPTION_CONSOLE
@ HANDLEGENERICEXCEPTION_CONSOLE
Definition: Application.h:867
RoR::TerrainObjectManager::SpawnSinglePredefinedActor
void SpawnSinglePredefinedActor(TerrainEditorObjectPtr const &object)
Definition: TerrainObjectManager.cpp:1036
RoR::GameContext::GetTerrain
const TerrainPtr & GetTerrain()
Definition: GameContext.h:117