From 08f8eec4322ce22d126c8ca7aa7f2fbafcd37604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 12:16:29 +0100 Subject: [PATCH 1/6] Adjusted the size of switch_inner so it does not move to the sides. --- data/levels/Compositions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/levels/Compositions.xml b/data/levels/Compositions.xml index 5ad3603..3d3631e 100644 --- a/data/levels/Compositions.xml +++ b/data/levels/Compositions.xml @@ -145,7 +145,7 @@ 0.0 0.0 0.0 - 1.0 + 1.044 0.5 From 39e731fa42ca053ad7dfbf14bb433fd37e737226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 12:22:47 +0100 Subject: [PATCH 2/6] Added position constraints for all switch_inner. --- data/levels/Level1.xml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/data/levels/Level1.xml b/data/levels/Level1.xml index 14a8fc3..c7c6157 100644 --- a/data/levels/Level1.xml +++ b/data/levels/Level1.xml @@ -706,6 +706,13 @@ 0 112 120 + + 0 + -6.5 + 22.0 + 51.5 + 12.0 + - 0 @@ -735,6 +742,13 @@ 0 111 120 + + 0 + -6.5 + 22.0 + 29.5 + 12.0 + - 0 @@ -2388,6 +2402,13 @@ 0 45 120 + + 0 + -53.5 + 22.0 + 51.5 + 12.0 + - 0 @@ -2446,6 +2467,13 @@ 0 43 120 + + 0 + -53.5 + 22.0 + 29.5 + 12.0 + - 0 @@ -3635,6 +3663,13 @@ 0 1 120 + + 0 + -161.5 + 21.7 + 67.5 + 12.0 + - 0 @@ -6105,7 +6140,7 @@ 17.5 22.0 159.5 - 7.0 + 12.0 openFirstDoor From cb538cb9fff5290081fbc72237ff11c1c6532754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 12:42:04 +0100 Subject: [PATCH 3/6] Moved unused scripts into a subfolder. --- data/levels/scripts/{ => unused}/deleteObject.lua | 0 data/levels/scripts/{ => unused}/deleteRandomObject.lua | 0 data/levels/scripts/{ => unused}/openDoor1.lua | 0 data/levels/scripts/{ => unused}/openDoor1undo.lua | 0 data/levels/scripts/{ => unused}/openDoor2.lua | 0 data/levels/scripts/{ => unused}/openDoor2undo.lua | 0 data/levels/scripts/{ => unused}/openDoor3.lua | 0 data/levels/scripts/{ => unused}/openDoor3undo.lua | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename data/levels/scripts/{ => unused}/deleteObject.lua (100%) rename data/levels/scripts/{ => unused}/deleteRandomObject.lua (100%) rename data/levels/scripts/{ => unused}/openDoor1.lua (100%) rename data/levels/scripts/{ => unused}/openDoor1undo.lua (100%) rename data/levels/scripts/{ => unused}/openDoor2.lua (100%) rename data/levels/scripts/{ => unused}/openDoor2undo.lua (100%) rename data/levels/scripts/{ => unused}/openDoor3.lua (100%) rename data/levels/scripts/{ => unused}/openDoor3undo.lua (100%) diff --git a/data/levels/scripts/deleteObject.lua b/data/levels/scripts/unused/deleteObject.lua similarity index 100% rename from data/levels/scripts/deleteObject.lua rename to data/levels/scripts/unused/deleteObject.lua diff --git a/data/levels/scripts/deleteRandomObject.lua b/data/levels/scripts/unused/deleteRandomObject.lua similarity index 100% rename from data/levels/scripts/deleteRandomObject.lua rename to data/levels/scripts/unused/deleteRandomObject.lua diff --git a/data/levels/scripts/openDoor1.lua b/data/levels/scripts/unused/openDoor1.lua similarity index 100% rename from data/levels/scripts/openDoor1.lua rename to data/levels/scripts/unused/openDoor1.lua diff --git a/data/levels/scripts/openDoor1undo.lua b/data/levels/scripts/unused/openDoor1undo.lua similarity index 100% rename from data/levels/scripts/openDoor1undo.lua rename to data/levels/scripts/unused/openDoor1undo.lua diff --git a/data/levels/scripts/openDoor2.lua b/data/levels/scripts/unused/openDoor2.lua similarity index 100% rename from data/levels/scripts/openDoor2.lua rename to data/levels/scripts/unused/openDoor2.lua diff --git a/data/levels/scripts/openDoor2undo.lua b/data/levels/scripts/unused/openDoor2undo.lua similarity index 100% rename from data/levels/scripts/openDoor2undo.lua rename to data/levels/scripts/unused/openDoor2undo.lua diff --git a/data/levels/scripts/openDoor3.lua b/data/levels/scripts/unused/openDoor3.lua similarity index 100% rename from data/levels/scripts/openDoor3.lua rename to data/levels/scripts/unused/openDoor3.lua diff --git a/data/levels/scripts/openDoor3undo.lua b/data/levels/scripts/unused/openDoor3undo.lua similarity index 100% rename from data/levels/scripts/openDoor3undo.lua rename to data/levels/scripts/unused/openDoor3undo.lua From 80df2aac41182e8f6d1e82eb2f466eec6fc29cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 12:58:34 +0100 Subject: [PATCH 4/6] Added lua scripts and triggers for the third door. --- data/levels/Compositions.xml | 2 +- data/levels/Level1.xml | 43 +++++++++++++++++++---- data/levels/scripts/openFirstDoor.lua | 2 +- data/levels/scripts/openThirdDoor.lua | 23 ++++++++++++ data/levels/scripts/openThirdDoorUndo.lua | 23 ++++++++++++ 5 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 data/levels/scripts/openThirdDoor.lua create mode 100644 data/levels/scripts/openThirdDoorUndo.lua diff --git a/data/levels/Compositions.xml b/data/levels/Compositions.xml index 3d3631e..39c046f 100644 --- a/data/levels/Compositions.xml +++ b/data/levels/Compositions.xml @@ -435,7 +435,7 @@ 0.0 0.0 1.5 - 0.0 + 100.0 diff --git a/data/levels/Level1.xml b/data/levels/Level1.xml index c7c6157..f5a3035 100644 --- a/data/levels/Level1.xml +++ b/data/levels/Level1.xml @@ -3671,18 +3671,33 @@ 12.0 - - - 0 - 0 - 0 + openThirdDoor + -161.5 + 21.7 + 67.5 - - - 1.0 + 0.2 + true + 0 + openThirdDoor.lua + 0 + 178 + 0 + + + openThirdDoorUndo + -161.5 + 21.7 + 67.5 + - + - + 0.2 false 0 - - + openThirdDoorUndo.lua 0 - 0 + 178 0 @@ -8571,6 +8586,13 @@ 1 8 221 + + 0 + -81.5 + 25.0 + 4.5 + 100.0 + - 0 @@ -10514,6 +10536,13 @@ 0 178 221 + + 0 + -172.5 + 25.0 + 58.5 + 100.0 + - 0 diff --git a/data/levels/scripts/openFirstDoor.lua b/data/levels/scripts/openFirstDoor.lua index b333b91..0dceaa4 100644 --- a/data/levels/scripts/openFirstDoor.lua +++ b/data/levels/scripts/openFirstDoor.lua @@ -11,7 +11,7 @@ function trigger(objectToChange) local strength = 100 local xPos = 17.5 - local yPos = 35 + local yPos = 33 local zPos = 81.5 level:moveObject(objectToChange, strength, xPos, yPos, zPos) diff --git a/data/levels/scripts/openThirdDoor.lua b/data/levels/scripts/openThirdDoor.lua new file mode 100644 index 0000000..e1776de --- /dev/null +++ b/data/levels/scripts/openThirdDoor.lua @@ -0,0 +1,23 @@ +local global = require( "global" ) +if(global.triggeredOpenThirdDoor == nil) then + global.triggeredOpenThirdDoor = false +end +function trigger(objectToChange) + if(global.triggeredOpenThirdDoor == false) then + if(not level) then + print("No level found in Lua!") + return + end + + local strength = 100 + local xPos = -172.5 + local yPos = 33 + local zPos = 58.5 + level:moveObject(objectToChange, strength, xPos, yPos, zPos) + + global.triggeredOpenThirdDoorUndo = false + + global.triggeredOpenThirdDoor = true + print("openThirdDoor") + end +end diff --git a/data/levels/scripts/openThirdDoorUndo.lua b/data/levels/scripts/openThirdDoorUndo.lua new file mode 100644 index 0000000..f183e34 --- /dev/null +++ b/data/levels/scripts/openThirdDoorUndo.lua @@ -0,0 +1,23 @@ +local global = require( "global" ) +if(global.triggeredOpenThirdDoorUndo == nil) then + global.triggeredOpenThirdDoorUndo = true +end +function trigger(objectToChange) + if(global.triggeredOpenThirdDoorUndo == false) then + if(not level) then + print("No level found in Lua!") + return + end + + local strength = 100 + local xPos = -172.5 + local yPos = 25 + local zPos = 58.5 + level:moveObject(objectToChange, strength, xPos, yPos, zPos) + + global.triggeredOpenThirdDoor = false + + global.triggeredOpenThirdDoorUndo = true + print("openThirdDoorUndo") + end +end From 1ad25ef8cbe1cb9f27d90707d96858620ad6b32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 14:28:19 +0100 Subject: [PATCH 5/6] Ignored first two seconds of triggering to give switches time to position themselves. --- level.cc | 12 +++++++----- level.hh | 2 +- main.cc | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/level.cc b/level.cc index 03d0e5c..776f9e3 100644 --- a/level.cc +++ b/level.cc @@ -56,8 +56,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass, } } -void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { - physics.takeUpdateStep(runTime); +void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) { + physics.takeUpdateStep(runTimeSinceLastUpdate); // Ignore first two mouse updates, because they are incorrect // DON'T try to move this functionallity elsewhere @@ -102,9 +102,11 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre skydome->setPosition(glm::vec3(cameraCenter->getPosition().x, 0.0f, cameraCenter->getPosition().z)); - - for(unsigned int i = 0; i 2.0f) { + for(unsigned int i = 0; i* shadowVPs=0); glm::vec3 getAmbientLight(); diff --git a/main.cc b/main.cc index 027e6be..6a876be 100644 --- a/main.cc +++ b/main.cc @@ -161,13 +161,13 @@ int main( int argc, char *argv[] ) double xpos, ypos; glfwGetCursorPos(window, &xpos, &ypos); glfwSetCursorPos(window, app.getGraphics()->getWindowSize().x/2, app.getGraphics()->getWindowSize().y/2); - app.getLevel()->update(now - lastUpdate, + app.getLevel()->update(now - lastUpdate, now, 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); } else { - app.getLevel()->update(now - lastUpdate, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); + app.getLevel()->update(now - lastUpdate, now, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false); if (app.isLocked()) { app.ignoredOneMouseUpdate(); } From 262241f559be272815be230d08bcc5c905b63445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 15:09:29 +0100 Subject: [PATCH 6/6] Recalculated normals because they were wrong. --- data/geometry/gate.obj | 56 ++++++++++++++++++------------------ data/geometry/simpleWall.obj | 52 ++++++++++++++++----------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/data/geometry/gate.obj b/data/geometry/gate.obj index 933bc57..e8f808c 100644 --- a/data/geometry/gate.obj +++ b/data/geometry/gate.obj @@ -1,52 +1,52 @@ -# Blender v2.72 (sub 0) OBJ File: 'Gate.blend' +# Blender v2.72 (sub 0) OBJ File: '' # www.blender.org -o Wall_Cube.001 -v 0.537791 -3.045326 3.045326 -v 0.537791 -3.045326 -3.045326 -v -0.537791 -3.045326 -3.045326 -v -0.537791 -3.045326 3.045326 -v 0.537791 3.045326 3.045326 +o Wall_Cube.000 v 0.537791 3.045326 -3.045326 -v -0.537791 3.045326 -3.045326 +v 0.537791 -3.045326 -3.045326 +v 0.537791 -3.045326 3.045326 v -0.537791 3.045326 3.045326 +v -0.537791 -3.045326 3.045326 +v -0.537791 -3.045326 -3.045326 +v 0.537791 3.045326 3.045326 +v -0.537791 3.045326 -3.045326 vt 1.000000 0.000000 -vt 1.000000 -1.000000 vt 0.000000 -1.000000 +vt 1.000000 -1.000000 vt -1.000000 0.000000 vt -1.000000 -1.000000 vt 0.000000 0.000000 vt 0.039666 1.000166 -vt 0.039666 0.000166 vt 0.000334 0.000166 +vt 0.039666 0.000166 vt 0.960071 -0.007992 -vt 0.959736 0.992008 vt 0.993184 0.992028 +vt 0.959736 0.992008 vt 0.002338 0.996941 -vt 0.032299 0.996953 vt 0.032522 -0.000041 +vt 0.032299 0.996953 vt 0.995477 0.006970 -vt 0.952679 0.006970 vt 0.952679 0.987810 +vt 0.952679 0.006970 vt 0.000334 1.000166 vt 0.993520 -0.007972 vt 0.002561 -0.000052 vt 0.995477 0.987810 -vn -1.000000 0.000000 0.000000 vn 1.000000 0.000000 0.000000 -vn 0.000000 0.000000 1.000000 +vn -1.000000 0.000000 0.000000 vn 0.000000 0.000000 -1.000000 +vn 0.000000 -0.000000 1.000000 +vn 0.000000 -1.000000 -0.000000 vn 0.000000 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 s off -f 6/1/1 2/2/1 1/3/1 -f 8/4/2 4/5/2 3/3/2 -f 5/6/1 6/1/1 1/3/1 -f 7/6/2 8/4/2 3/3/2 -f 7/7/3 3/8/3 2/9/3 -f 5/10/4 1/11/4 4/12/4 -f 2/13/5 3/14/5 4/15/5 -f 7/16/6 6/17/6 5/18/6 -f 6/19/3 7/7/3 2/9/3 -f 8/20/4 5/10/4 4/12/4 -f 1/21/5 2/13/5 4/15/5 -f 8/22/6 7/16/6 5/18/6 +f 1/1/1 3/2/1 2/3/1 +f 4/4/2 6/2/2 5/5/2 +f 7/6/1 3/2/1 1/1/1 +f 8/6/2 6/2/2 4/4/2 +f 8/7/3 2/8/3 6/9/3 +f 7/10/4 5/11/4 3/12/4 +f 2/13/5 5/14/5 6/15/5 +f 8/16/6 7/17/6 1/18/6 +f 1/19/3 2/8/3 8/7/3 +f 4/20/4 5/11/4 7/10/4 +f 3/21/5 5/14/5 2/13/5 +f 4/22/6 7/17/6 8/16/6 diff --git a/data/geometry/simpleWall.obj b/data/geometry/simpleWall.obj index 9a3ce29..09efc68 100644 --- a/data/geometry/simpleWall.obj +++ b/data/geometry/simpleWall.obj @@ -1,54 +1,54 @@ -# Blender v2.72 (sub 0) OBJ File: 'SimpleWall.blend' +# Blender v2.72 (sub 0) OBJ File: '' # www.blender.org o Wall_Cube.001 -v 0.537791 -3.045326 3.045326 +v 0.537791 3.045326 -3.045326 v 0.537791 -3.045326 -3.045326 +v 0.537791 -3.045326 3.045326 +v -0.537791 3.045326 -3.045326 v -0.537791 -3.045326 -3.045326 +v -0.537791 3.045326 3.045326 v -0.537791 -3.045326 3.045326 v 0.537791 3.045326 3.045326 -v 0.537791 3.045326 -3.045326 -v -0.537791 3.045326 -3.045326 -v -0.537791 3.045326 3.045326 vt 1.002363 0.998329 -vt 1.002363 -0.001671 vt 0.005637 -0.001671 +vt 1.002363 -0.001671 vt 0.394169 0.995358 -vt 0.394169 -0.004642 vt 0.605831 -0.004642 +vt 0.394169 -0.004642 vt -0.003002 0.995358 -vt -0.003002 -0.004642 vt 0.996752 -0.004642 +vt -0.003002 -0.004642 vt 0.605361 0.992386 -vt 0.605361 -0.007614 vt 0.392389 -0.007614 +vt 0.605361 -0.007614 vt 0.001396 0.906027 -vt 0.001923 0.094175 vt 0.998604 0.093973 +vt 0.001923 0.094175 vt 1.000000 0.097080 -vt 1.000000 0.902920 vt 0.000000 0.902920 +vt 1.000000 0.902920 vt 0.005637 0.998329 vt 0.605831 0.995358 vt 0.996752 0.995358 vt 0.392389 0.992386 vt 0.998077 0.905824 vt 0.000000 0.097080 -vn -1.000000 0.000000 0.000000 -vn 0.000000 0.000000 1.000000 vn 1.000000 0.000000 0.000000 vn 0.000000 0.000000 -1.000000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 -0.000000 1.000000 +vn 0.000000 -1.000000 -0.000000 vn 0.000000 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 s off -f 6/1/1 2/2/1 1/3/1 -f 7/4/2 3/5/2 2/6/2 -f 8/7/3 4/8/3 3/9/3 -f 5/10/4 1/11/4 4/12/4 -f 2/13/5 3/14/5 4/15/5 -f 7/16/6 6/17/6 5/18/6 -f 5/19/1 6/1/1 1/3/1 -f 6/20/2 7/4/2 2/6/2 -f 7/21/3 8/7/3 3/9/3 -f 8/22/4 5/10/4 4/12/4 -f 1/23/5 2/13/5 4/15/5 -f 8/24/6 7/16/6 5/18/6 +f 1/1/1 3/2/1 2/3/1 +f 4/4/2 2/5/2 5/6/2 +f 6/7/3 5/8/3 7/9/3 +f 8/10/4 7/11/4 3/12/4 +f 2/13/5 7/14/5 5/15/5 +f 4/16/6 8/17/6 1/18/6 +f 8/19/1 3/2/1 1/1/1 +f 1/20/2 2/5/2 4/4/2 +f 4/21/3 5/8/3 6/7/3 +f 6/22/4 7/11/4 8/10/4 +f 3/23/5 7/14/5 2/13/5 +f 6/24/6 8/17/6 4/16/6