MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Simulate

Method Simulate

engine/Poseidon/Game/Editor.cpp:981–1661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

979}
980
981void EditCursor::Simulate(float deltaT, SimulationImportance prec)
982{
983 int i, j, x, z;
984 auto& input = InputSubsystem::Instance();
985 Landscape* land = GLOB_LAND;
986
987 // restore unmagnetized positions
988 if (m_bMagnetize)
989 {
990 for (i = 0; i < m_Selection.Size(); i++)
991 {
992 land->GetObject(m_Selection[i])->SetTransform(m_transPure[i]);
993 }
994 m_transPure.Init(INIT_SEL_ITEMS);
995 m_bMagnetize = false;
996 }
997
998 // process events from editor
999 m_bMoved = false;
1000 bool busy = ProcessEvents();
1001
1002 if (input.ConsumeKeyPress(SDL_SCANCODE_INSERT))
1003 {
1004 SwitchCamera();
1005 }
1006
1007 // init
1008 Vector3 position = Position();
1009 float rotYAngle = 0, rotXAngle = 0;
1010
1011 const bool* keystate = SDL_GetKeyboardState(nullptr);
1012 bool bFaster = keystate[SDL_SCANCODE_SCROLLLOCK];
1013 float speedKeyb = deltaT * SPEED_KEYB;
1014
1015 bool bReset = false; // Reset camera position
1016 Point3 ptMin, ptMax;
1017
1018 // translate cursor keys to mouse moving
1019 float speedX = input.GetMouseDeltaX() * SPEED_MOUSE;
1020 float speedZ = -input.GetMouseDeltaY() * SPEED_MOUSE;
1021 if (bFaster)
1022 {
1023 speedX *= SPEED_SCROLL;
1024 speedZ *= SPEED_SCROLL;
1025 speedKeyb *= SPEED_SCROLL;
1026 }
1027
1028 Frame moveTrans;
1029 moveTrans.SetTransform(*this);
1030
1031 // process mouse moving
1032 if (_cameraOnEdit)
1033 {
1034 // edit cursor movement
1035
1036 switch (MODE(m_wFlags))
1037 {
1038 case MODE_NORMAL:

Callers

nothing calls this directly

Calls 15

saturateFunction · 0.85
floatMaxFunction · 0.85
floatMinFunction · 0.85
saturateMaxFunction · 0.85
TransformFunction · 0.85
logFunction · 0.85
ObjectTypeEnum · 0.85
findLastSepFunction · 0.85
GetMouseDeltaXMethod · 0.80
GetMouseDeltaYMethod · 0.80
IsKeyDownMethod · 0.80
SurfaceYMethod · 0.80

Tested by

no test coverage detected