diff --git a/source/game/game.cpp b/source/game/game.cpp index e4d3fec4a..fdbf9483c 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -306,7 +306,9 @@ void CGameScene::initLevel() m_player->setRespawnPos(Level.getPlayerSpawnPos()); m_player->init(); m_player->setLayerCollision(Level.getCollisionLayer()); - m_player->setMapSize(Level.getMapSize()); + DVECTOR mapSize=Level.getMapSize(); + CPlayer::CameraBox camBox={0,0,mapSize.vx,mapSize.vy}; + m_player->setCameraBox(camBox); // Init actors (needs moving and tidying int actorNum; diff --git a/source/player/player.cpp b/source/player/player.cpp index 5f9c43a60..19cb8a41c 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -619,12 +619,11 @@ if(newmode!=-1) m_invincibleFrameCount--; } - -if(Pos.vx<64)Pos.vx=64; -else if(Pos.vx>m_mapEdge.vx-64)Pos.vx=m_mapEdge.vx-64; -if(Pos.vy<64)Pos.vy=64; -else if(Pos.vy>m_mapEdge.vy-64)Pos.vy=m_mapEdge.vy-64; - + // Stop the player vanishing off the edge of the telly.. + if(Pos.vxm_playerPosLimitBox.x2) Pos.vx=m_playerPosLimitBox.x2; + if(Pos.vym_playerPosLimitBox.y2) Pos.vy=m_playerPosLimitBox.y2; // Look around int pad=getPadInputHeld(); @@ -775,24 +774,11 @@ else if(Pos.vy>m_mapEdge.vy-64)Pos.vy=m_mapEdge.vy-64; m_cameraPos.vx=m_currentCamFocusPoint.vx; m_cameraPos.vy=m_currentCamFocusPoint.vy+yoff; - // Limit camera scroll to the edges of the map - if(m_cameraPos.vx<0) - { - m_cameraPos.vx=0; - } - else if(m_cameraPos.vx>m_mapCameraEdges.vx) - { - m_cameraPos.vx=m_mapCameraEdges.vx; - } - if(m_cameraPos.vy<0) - { - m_cameraPos.vy=0; - } - else if(m_cameraPos.vy>m_mapCameraEdges.vy) - { - m_cameraPos.vy=m_mapCameraEdges.vy; - } + if(m_cameraPos.vxm_cameraPosLimitBox.x2) m_cameraPos.vx=m_cameraPosLimitBox.x2; + if(m_cameraPos.vym_cameraPosLimitBox.y2) m_cameraPos.vy=m_cameraPosLimitBox.y2; CPlayerThing::think(_frames); } @@ -945,15 +931,28 @@ for(int i=0;i