From b68c464831580ec933f30b95e47dfd9bc7021ae6 Mon Sep 17 00:00:00 2001 From: Peter Schaefer Date: Tue, 3 May 2016 22:35:02 +0200 Subject: [PATCH] added Revert LOST --- .gitignore | 6 +++- Weave/Game.cpp | 3 +- Weave/Graphix/Textures/tImage.cpp | 5 ++- Weave/Graphix/Textures/tImage.h | 2 ++ Weave/Scene/EventBox.cpp | 6 +++- Weave/Scene/EventBox.h | 1 - Weave/Scene/Marvin.cpp | 57 +++++++++++++++++-------------- Weave/Scene/Marvin.h | 2 ++ Weave/Scene/Scene.cpp | 1 + Weave/Scene/SceneObject.h | 2 ++ Weave/Weave.vcxproj | 2 +- 11 files changed, 53 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index d596d27..ec689be 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,8 @@ res *.[Cc]ache CGUE*.rar -CGUE*.zip \ No newline at end of file +CGUE*.zip + +*.aux +*.bbl +*.blg \ No newline at end of file diff --git a/Weave/Game.cpp b/Weave/Game.cpp index 6001e41..b167f42 100644 --- a/Weave/Game.cpp +++ b/Weave/Game.cpp @@ -68,7 +68,8 @@ Game::Game() : playing(true) current_world->addObject(new SceneObject(translate(vec3(-5.f, 3.f, 0.f)), vec4(3.0f, 3.f, 0.4f, 1.5f), "SkyBox", "model_SkyBox_2D.png")); - //current_world->addObject(new EventBox(translate(vec3(3.f, .4f, 0.f)),EB_LOSTZONE)); + current_world->addObject(new EventBox(translate(vec3(3.f, .4f, 0.f)),EB_LOSTZONE)); + //current_world->addObject(new EventBox(translate(vec3(0.f, -5.f, 0.f))*glm::scale(vec3(50.f,1.f,50.f)), EB_LOSTZONE)); current_world->addObject(new EventBox(translate(vec3(3.f, .4f, -15.f)), EB_WINZONE)); } diff --git a/Weave/Graphix/Textures/tImage.cpp b/Weave/Graphix/Textures/tImage.cpp index 01b5322..ea09699 100644 --- a/Weave/Graphix/Textures/tImage.cpp +++ b/Weave/Graphix/Textures/tImage.cpp @@ -1,9 +1,8 @@ #include "tImage.h" +#include "FreeImage.h" #include #include "../Shader.h" -#include "FreeImage.h" - #include "../../Message.h" @@ -82,4 +81,4 @@ void tImage::loadImage(const std::string & _path) tImage::operator std::string() const { return path; -} \ No newline at end of file +} diff --git a/Weave/Graphix/Textures/tImage.h b/Weave/Graphix/Textures/tImage.h index 18f262e..dce65bf 100644 --- a/Weave/Graphix/Textures/tImage.h +++ b/Weave/Graphix/Textures/tImage.h @@ -1,5 +1,7 @@ #pragma once + #include "Texture.h" +#include "FreeImage.h" #include "../../GLM.h" #include diff --git a/Weave/Scene/EventBox.cpp b/Weave/Scene/EventBox.cpp index 0ef1c80..e924fa6 100644 --- a/Weave/Scene/EventBox.cpp +++ b/Weave/Scene/EventBox.cpp @@ -1,5 +1,7 @@ #include "EventBox.h" +#include "Marvin.h" + //#include "../Graphix/Graphix.h" #include "../Graphix/Shader.h" #include "../Graphix/Model.h" @@ -63,7 +65,9 @@ void EventBox::collides(SceneObject* _other, btPersistentManifold* _contactManif break; case EB_LOSTZONE: Message::info("Spiel Verloren!"); - Events::halt = true; + //Events::halt = true; + _other->movable = false; + break; case EB_WINZONE: Message::info("Spiel Gewonnen!"); diff --git a/Weave/Scene/EventBox.h b/Weave/Scene/EventBox.h index f1b4ab3..9bae021 100644 --- a/Weave/Scene/EventBox.h +++ b/Weave/Scene/EventBox.h @@ -22,5 +22,4 @@ public: protected: uint eb_type; - }; diff --git a/Weave/Scene/Marvin.cpp b/Weave/Scene/Marvin.cpp index 0c86498..95b3295 100644 --- a/Weave/Scene/Marvin.cpp +++ b/Weave/Scene/Marvin.cpp @@ -32,36 +32,41 @@ void Marvin::update(float deltaT) Camera& cam(mainScene->getCam()); - - //Jump - if (Events::getJump() && abs(yFloorDist)<.5) - ySpeed += 5.5; - - int move_x = Events::getMoveX(); - int move_y = Events::getMoveY(); - // MOVE Player - if (move_x) - move(-SPEED_MOVE_NORMAL *move_x * deltaT * cam.getWorldRight()); - - if (move_y){ - if (move_y > 0){ - if (move_delta < TIME_TILL_MAX_MOVE) - move_delta += deltaT; - if (move_delta > TIME_TILL_MAX_MOVE) - move_delta = TIME_TILL_MAX_MOVE; - move(SPEED_MOVE_NORMAL * (MOVE_FASTER * move_delta / TIME_TILL_MAX_MOVE + 1) *move_y * deltaT * cam.getWorldDirection()); + if (movable) + { + //Jump + if (Events::getJump() && abs(yFloorDist)<.5) + ySpeed += 5.5; + + int move_x = Events::getMoveX(); + int move_y = Events::getMoveY(); + // MOVE Player + if (move_x) + move(-SPEED_MOVE_NORMAL *move_x * deltaT * cam.getWorldRight()); + + if (move_y) { + if (move_y > 0) { + if (move_delta < TIME_TILL_MAX_MOVE) + move_delta += deltaT; + if (move_delta > TIME_TILL_MAX_MOVE) + move_delta = TIME_TILL_MAX_MOVE; + move(SPEED_MOVE_NORMAL * (MOVE_FASTER * move_delta / TIME_TILL_MAX_MOVE + 1) *move_y * deltaT * cam.getWorldDirection()); + } + else + move(SPEED_MOVE_NORMAL *move_y * deltaT * cam.getWorldDirection()); } else - move(SPEED_MOVE_NORMAL *move_y * deltaT * cam.getWorldDirection()); - } - else - { - move_delta = 0; + { + move_delta = 0; + } + + //Rotate Play in move direction + if (move_x || move_y) + turnTo(cam.getWorldDirection(), 3 * deltaT / TIME_TILL_DIRECTION_ROTATE); } + - //Rotate Play in move direction - if (move_x || move_y) - turnTo(cam.getWorldDirection(), 3 * deltaT / TIME_TILL_DIRECTION_ROTATE); + SceneObject::update(deltaT); } diff --git a/Weave/Scene/Marvin.h b/Weave/Scene/Marvin.h index 4e688b2..63a3cd6 100644 --- a/Weave/Scene/Marvin.h +++ b/Weave/Scene/Marvin.h @@ -15,5 +15,7 @@ public: virtual void update(float) override; protected: + + }; diff --git a/Weave/Scene/Scene.cpp b/Weave/Scene/Scene.cpp index d5909e7..a7b1590 100644 --- a/Weave/Scene/Scene.cpp +++ b/Weave/Scene/Scene.cpp @@ -193,6 +193,7 @@ void Scene::update(float deltaT) //TODO go from keyframe to current time lookat->setModel(prev_mat); lookat->ySpeed = prev_ySpeed; + lookat->movable = true; //for (auto i = SceneObjects.begin(); i != SceneObjects.end(); ++i) diff --git a/Weave/Scene/SceneObject.h b/Weave/Scene/SceneObject.h index 0232a66..4ab3f50 100644 --- a/Weave/Scene/SceneObject.h +++ b/Weave/Scene/SceneObject.h @@ -89,6 +89,8 @@ public: bool ignore; + bool movable = true; + protected: mat4 modelMat; diff --git a/Weave/Weave.vcxproj b/Weave/Weave.vcxproj index 2497198..454b423 100644 --- a/Weave/Weave.vcxproj +++ b/Weave/Weave.vcxproj @@ -73,7 +73,7 @@ Level3 - MaxSpeed + Disabled true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) -- 2.47.3