mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 02:42:46 +01:00
Merge branch 'feat/eu07m-gref' into feat/eu07m-model-inspector
The base split vehicle/DynObj.cpp into vehicle/dynamic/*: the holds of the editor on the parts and the pantographs move with it. The table and the functions of the holds go to the end of vehicle/dynamic/visual.cpp, the held lamps and hooks are applied in ABuLittleUpdate there, and a held pantograph is moved at the start of updatePantographMotion (vehicle/dynamic/update.cpp), which skips the pressure-driven motion as the old loop did with continue. DynObj.h keeps both sides: the LightList of the VehicleEnd rename and the holds. The two reads of MoverParameters this branch added go through TDynamicObject, as the base's AGENTS.md asks outside physics/ and vehicle/: GetLength() for the fly-to distance, and a new query OccupiedCab() for the side of the cab entered.
This commit is contained in:
@@ -22,6 +22,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "application/editorgestures.h"
|
||||
#include "scene/scenenodegroups.h"
|
||||
#include "application/editoruilayer.h"
|
||||
#include "physics/vehicle.h"
|
||||
#include "vehicle/DynObj.h"
|
||||
#ifndef _WIN32
|
||||
#include <spawn.h>
|
||||
#include <unistd.h>
|
||||
@@ -5868,7 +5870,7 @@ bool editor_mode::enter_cab(TDynamicObject &Vehicle)
|
||||
if ((Vehicle.mdKabina == nullptr) || (Vehicle.mdKabina == Vehicle.mdModel))
|
||||
return false;
|
||||
// in the seat of the driver, looking ahead from the cab taken
|
||||
auto const side{Vehicle.MoverParameters->CabOccupied < 0 ? -1.0 : 1.0};
|
||||
auto const side{Vehicle.OccupiedCab() < 0 ? -1.0 : 1.0};
|
||||
auto const look{Vehicle.VectorFront() * side};
|
||||
Camera.Pos = Vehicle.GetWorldPosition(train->pMechSittingPosition);
|
||||
Camera.Angle = glm::vec3(0.0f, static_cast<float>(std::atan2(-look.x, -look.z)), 0.0f);
|
||||
@@ -7721,7 +7723,7 @@ void editor_mode::enter()
|
||||
auto const *vehicle = Camera.m_owner;
|
||||
if (vehicle)
|
||||
{
|
||||
const int cab = vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied;
|
||||
const int cab = vehicle->physics->CabOccupied() == 0 ? 1 : vehicle->physics->CabOccupied();
|
||||
const glm::dvec3 left = vehicle->VectorLeft() * (double)cab;
|
||||
Camera.Pos = glm::dvec3(Camera.Pos.x, vehicle->GetPosition().y, Camera.Pos.z) + left * vehicle->GetWidth() + glm::dvec3(1.25f * left.x, 1.6f, 1.25f * left.z);
|
||||
Camera.m_owner = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user