diff --git a/source/player/player.cpp b/source/player/player.cpp index ffc4b45eb..32a931dd9 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -767,6 +767,13 @@ if(newmode!=-1) /// + // Pending teleport? + if(m_teleportPending) + { + processTeleportToCommand(); + } + + for(i=0;i<_frames;i++) { updatePadInput(); @@ -1809,16 +1816,26 @@ void CPlayer::teleportTo(int _x,int _y) { DVECTOR pos={_x,_y}; + m_teleportPendingPos=pos; + m_teleportPending=true; +} + +void CPlayer::processTeleportToCommand() +{ + ASSERT(m_teleportPending); + CameraBox releaseCamBox={0,0,29999,29999}; setCameraBox(releaseCamBox); - setPos(pos); - setRespawnPos(pos); + setPos(m_teleportPendingPos); + setRespawnPos(m_teleportPendingPos); calcCameraFocusPointTarget(); m_currentCamFocusPoint=m_currentCamFocusPointTarget; + m_teleportPending=false; } + /*---------------------------------------------------------------------- Function: Purpose: @@ -1954,6 +1971,7 @@ void CPlayer::respawn() m_ignoreNewlyPressedButtonsOnPadThisThink=true; m_canExitLevel=false; + m_teleportPending=false; } /*---------------------------------------------------------------------- diff --git a/source/player/player.h b/source/player/player.h index 0fd35c958..fb13e2711 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -276,6 +276,10 @@ public: void teleportTo(int _x,int _y); private: + void processTeleportToCommand(); + int m_teleportPending; + DVECTOR m_teleportPendingPos; + void playAnimFrameSfx(int _animNo,int _animFrame); void calcCameraFocusPointTarget();