Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #183 from storm-devs/feature/backport-dmc-camera-msgs
Browse files Browse the repository at this point in the history
location: backport camera MSGs from DMC
  • Loading branch information
espkk authored Sep 5, 2021
2 parents f5ba5cf + e67f5a4 commit 3ceeead
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
54 changes: 43 additions & 11 deletions src/libs/location/src/LocationCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ uint64_t LocationCamera::ProcessMessage(MESSAGE &message)
}
return 1;
case MSG_CAMERA_FOLLOW:
forcedPos = false;
if (wmode != cwm_follow)
{
oldPos = camPos;
Expand All @@ -374,11 +375,7 @@ uint64_t LocationCamera::ProcessMessage(MESSAGE &message)
wmode = cwm_follow;
return 1;
case MSG_CAMERA_TOPOS:
/*if(lockAx)
{
core.Send_Message(GetId(), "l", MSG_CAMERA_FOLLOW);
return 1;
}*/
forcedPos = false;
fromLook.x = message.Float();
fromLook.y = message.Float();
fromLook.z = message.Float();
Expand All @@ -395,15 +392,20 @@ uint64_t LocationCamera::ProcessMessage(MESSAGE &message)
case MSG_CAMERA_MOVE:
lockAx = true;
lAx = message.Float();
break;
return 1;
case MSG_CAMERA_FREE:
forcedPos = false;
wmode = cwm_free;
kMorph = 1.0f;
return 1;
case MSG_CAMERA_SLEEP:
isSleep = message.Long() != 0;
return 1;
case MSG_CAMERA_SET_RADIUS:
radius = message.Float();
return 1;

// internal
case -1: {
const auto fSpeed = message.Float();
const auto fTime = message.Float();
Expand All @@ -412,21 +414,48 @@ uint64_t LocationCamera::ProcessMessage(MESSAGE &message)
const auto fAngSpeed = message.Float();
const auto fAngMax = message.Float();
TurnOnDynamicFov(fSpeed, fTime, fMin, fMax, fAngSpeed, fAngMax);
}
break;
return 1;
}

case -2: {
const std::string &trackname = message.String();
const auto fTrackTime = message.Float();
LoadCameraTrack(trackname.c_str(), fTrackTime);
auto *pA = message.AttributePointer();
// SetTrackCameraPauses(pA);
return 1;
}
break;

case -3:
TurnOffTrackCamera();
break;
return 1;

case -4:
// from point to point
fromLook.x = message.Float();
fromLook.y = message.Float();
fromLook.z = message.Float();
if (!message.Long())
{
oldPos = camPos;
oldLookTo = lookTo;
kMorph = 0.0f;
}
else
kMorph = 1.0f;
wmode = cwm_topos;

pos.x = message.Float();
pos.y = message.Float();
pos.z = message.Float();
forcedPos = true;

return 1;

default:
;
}

return 0;
}

Expand All @@ -448,7 +477,10 @@ bool LocationCamera::Set()
if (!c)
return false;
// Character characteristics
c->GetPosition(pos);
if (!forcedPos)
{
c->GetPosition(pos);
}
chay = c->GetAY();
height = c->GetHeight();
lheight = height * lookHeight;
Expand Down
2 changes: 2 additions & 0 deletions src/libs/location/src/LocationCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ class LocationCamera : public Entity
float TrackPauseProcess();

PathTracks m_track;

bool forcedPos = false;
};

inline void LocationCamera::LockFPMode(bool isLock)
Expand Down
1 change: 1 addition & 0 deletions src/libs/shared_headers/include/shared/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
#define MSG_CAMERA_FREE 30514 // "l" free flight of the camera

#define MSG_CAMERA_SLEEP 30520 // "ll" stop the camera (1) or resume (0)
#define MSG_CAMERA_SET_RADIUS 30521 // "lf" set radius

// Blots on the ship
#define MSG_BLOTS_SETMODEL 30600 // "li" set the model, model_id
Expand Down

0 comments on commit 3ceeead

Please sign in to comment.