Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Core/GameEngine/Include/GameClient/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ class View : public Snapshot
virtual Real getPitch() { return m_pitch; } ///< Return current camera pitch
virtual void setAngleToDefault(); ///< Set the view angle back to default
virtual void setPitchToDefault(); ///< Set the view pitch back to default
virtual void getPosition(Coord3D *pos) { *pos=m_pos;} ///< Returns position camera is looking at (z will be zero)
void setPosition( const Coord3D *pos ) { m_pos = *pos; }
void getPosition(Coord3D *pos) { *pos = m_pos;} ///< Returns position camera is looking at (z will be zero)

virtual const Coord3D& get3DCameraPosition() const = 0; ///< Returns the actual camera position

Expand All @@ -205,14 +206,10 @@ class View : public Snapshot
virtual void getLocation ( ViewLocation *location ); ///< write the view's current location in to the view location object
virtual void setLocation ( const ViewLocation *location ); ///< set the view's current location from to the view location object


virtual void drawView() = 0; ///< Render the world visible in this view.
virtual void updateView() = 0; ///<called once per frame to determine the final camera and object transforms
virtual void stepView() = 0; ///< Update view for every fixed time step




virtual ObjectID getCameraLock() const { return m_cameraLock; }
virtual void setCameraLock(ObjectID id) { m_cameraLock = id; m_lockDist = 0.0f; m_lockType = LOCK_FOLLOW; }
virtual void snapToCameraLock() { m_snapImmediate = TRUE; }
Expand Down Expand Up @@ -241,14 +238,12 @@ class View : public Snapshot
virtual void xfer( Xfer *xfer );
virtual void loadPostProcess() { }

void setPosition( const Coord3D *pos ) { m_pos = *pos; }
const Coord3D *getPosition() const { return &m_pos; }

virtual View *prependViewToList( View *list ); ///< Prepend this view to the given list, return the new list
virtual View *getNextView() { return m_next; } ///< Return next view in the set


// **********************************************************************************************
protected:

View *m_next; ///< List links used by the Display class

Expand Down Expand Up @@ -310,7 +305,9 @@ class ViewLocation
{
m_valid = FALSE;
m_pos.zero();
m_angle = m_pitch = m_zoom = 0.0;
m_angle = 0.0f;
m_pitch = 0.0f;
m_zoom = 0.0f;
}

const Coord3D& getPosition() const { return m_pos; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1861,15 +1861,15 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
{
if (TheTacticalView->isCameraMovementFinished())
{
ViewLocation loc;
Coord3D pos;
Real pitch, angle, zoom;
pos = msg->getArgument( 0 )->location;
angle = msg->getArgument( 1 )->real;
pitch = msg->getArgument( 2 )->real;
zoom = msg->getArgument( 3 )->real;
loc.init(pos.x, pos.y, pos.z, angle, pitch, zoom);
TheTacticalView->setLocation( &loc );
const Coord3D pos = msg->getArgument( 0 )->location;
const Real angle = msg->getArgument( 1 )->real;
const Real pitch = msg->getArgument( 2 )->real;
const Real zoom = msg->getArgument( 3 )->real;

TheTacticalView->setPosition(&pos);
TheTacticalView->setAngle(angle);
TheTacticalView->setPitch(pitch);
TheTacticalView->setZoom(zoom);

// TheSuperHackers @fix xezon 18/09/2025 Lock the new location to avoid user input from changing the camera in this frame.
TheTacticalView->lockViewUntilFrame( getFrame() + 1 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1889,15 +1889,15 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
{
if (TheTacticalView->isCameraMovementFinished())
{
ViewLocation loc;
Coord3D pos;
Real pitch, angle, zoom;
pos = msg->getArgument( 0 )->location;
angle = msg->getArgument( 1 )->real;
pitch = msg->getArgument( 2 )->real;
zoom = msg->getArgument( 3 )->real;
loc.init(pos.x, pos.y, pos.z, angle, pitch, zoom);
TheTacticalView->setLocation( &loc );
const Coord3D pos = msg->getArgument( 0 )->location;
const Real angle = msg->getArgument( 1 )->real;
const Real pitch = msg->getArgument( 2 )->real;
const Real zoom = msg->getArgument( 3 )->real;

TheTacticalView->setPosition(&pos);
TheTacticalView->setAngle(angle);
TheTacticalView->setPitch(pitch);
TheTacticalView->setZoom(zoom);
Comment thread
xezon marked this conversation as resolved.

// TheSuperHackers @fix xezon 18/09/2025 Lock the new location to avoid user input from changing the camera in this frame.
TheTacticalView->lockViewUntilFrame( getFrame() + 1 );
Expand Down
Loading