diff --git a/level.cc b/level.cc index ec7eaf7..0659e18 100644 --- a/level.cc +++ b/level.cc @@ -70,7 +70,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, } } -void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { +void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed, + bool f1Pressed, bool f2Pressed, bool f3Pressed, bool f4Pressed) { // Ignore first two mouse updates, because they are incorrect // DON'T try to move this functionallity elsewhere @@ -111,6 +112,19 @@ void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseD } } + if(f1Pressed) { + physics.forcePlayer(glm::vec3(17.5, 21.0, 87.0)); + } + if(f2Pressed) { + physics.forcePlayer(glm::vec3(-78.5, 21.75, 4.5)); + } + if(f3Pressed) { + physics.forcePlayer(glm::vec3(-169.5, 21.5, 58.5)); + } + if(f4Pressed) { + physics.forcePlayer(glm::vec3(-180.5, 21.75, 58.5)); + } + if(kPressed) camera.setIsPhysicsCamera(true); if(lPressed) diff --git a/level.hh b/level.hh index 5811b9e..60cf960 100644 --- a/level.hh +++ b/level.hh @@ -25,7 +25,8 @@ class Level { Level(); ~Level(); void load(); - void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed); + void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed, + bool f1Pressed, bool f2Pressed, bool f3Pressed, bool f4Pressed ); void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, glm::mat4* viewProjectionMatrix, std::vector* shadowVPs=0); glm::vec3 getAmbientLight(); diff --git a/main.cc b/main.cc index 318ed04..a02c794 100644 --- a/main.cc +++ b/main.cc @@ -166,6 +166,10 @@ int main( int argc, char *argv[] ) int stateD = glfwGetKey(window, GLFW_KEY_D); int stateK = glfwGetKey(window, GLFW_KEY_K); int stateL = glfwGetKey(window, GLFW_KEY_L); + int stateF1 = glfwGetKey(window, GLFW_KEY_F1); + int stateF2 = glfwGetKey(window, GLFW_KEY_F2); + int stateF3 = glfwGetKey(window, GLFW_KEY_F3); + int stateF4 = glfwGetKey(window, GLFW_KEY_F4); double xpos, ypos; glfwGetCursorPos(window, &xpos, &ypos); @@ -173,10 +177,11 @@ int main( int argc, char *argv[] ) app.getLevel()->update(now - lastUpdate, now - gameStart, glm::vec2((float)ypos-app.getGraphics()->getWindowSize().y/2, (float)xpos-app.getGraphics()->getWindowSize().x/2), - stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS); + stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS, stateF1 == GLFW_PRESS, + stateF2 == GLFW_PRESS, stateF3 == GLFW_PRESS, stateF4 == GLFW_PRESS); } else { - app.getLevel()->update(now - lastUpdate, now-gameStart, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); + app.getLevel()->update(now - lastUpdate, now-gameStart, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false,false,false,false,false); if (app.isLocked()) { app.ignoredOneMouseUpdate(); } diff --git a/physics.cc b/physics.cc index ade143b..d4a5014 100644 --- a/physics.cc +++ b/physics.cc @@ -43,6 +43,7 @@ void Physics::takeUpdateStep(float timeDiff) currentDirection = playerBall->getCenterOfMassPosition(); currentDirection.setY(0); currentDirection.normalize(); + cameraDistance = 15; } btVector3 position = currentDirection; diff --git a/physics.hh b/physics.hh index 98fbe53..3490526 100644 --- a/physics.hh +++ b/physics.hh @@ -88,7 +88,7 @@ class Physics { bool simulationActive = true; bool sinking = true; bool endgame = false; - btVector3 currentDirection = btVector3(1,1,1); + btVector3 currentDirection = btVector3(-1,1,1); btRigidBody* playerBall; //allows for easier access to the ball btRigidBody* terrainBody; //duh btRigidBody* cameraBody;