diff --git a/.gitignore b/.gitignore index db66441..db15a97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ # Project exclude paths /cmake-build-debug/ -/cmake-build-release/ \ No newline at end of file +/cmake-build-release/ +.idea/ +*.DS_Store +engine_log.txt +shooter \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 17d251e..3a018a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,90 +28,89 @@ add_executable(${CMAKE_PROJECT_NAME} ShooterConsts.h network/ShooterMsgType.h network/ShooterMsgType.cpp - network/Chat.cpp - network/Chat.h # 3d engine: - engine/Consts.h - engine/math/Vec4D.h - engine/math/Vec4D.cpp - engine/math/Vec3D.cpp - engine/math/Vec3D.h - engine/math/Vec2D.cpp - engine/math/Vec2D.h - engine/math/Matrix4x4.h - engine/math/Matrix4x4.cpp - engine/Triangle.h - engine/Triangle.cpp - engine/math/Plane.h - engine/math/Plane.cpp - engine/Mesh.h - engine/Mesh.cpp - engine/utils/Log.h - engine/utils/Log.cpp - engine/utils/Time.h - engine/utils/Time.cpp - engine/utils/Timer.cpp - engine/utils/Timer.h - engine/utils/ResourceManager.h - engine/utils/ResourceManager.cpp - engine/World.h - engine/World.cpp - engine/Camera.h - engine/Camera.cpp - engine/io/Screen.h - engine/io/Screen.cpp - engine/Engine.h - engine/Engine.cpp - engine/io/Keyboard.cpp - engine/io/Keyboard.h - engine/io/Mouse.cpp - engine/io/Mouse.h - engine/io/SoundController.cpp - engine/io/SoundController.h - engine/utils/ObjectController.cpp - engine/utils/ObjectController.h - engine/animation/Animation.h - engine/animation/Timeline.cpp - engine/animation/Timeline.h - engine/animation/Interpolation.h - engine/animation/Animation.cpp - engine/animation/ATranslate.h - engine/animation/AScale.h - engine/animation/ARotate.h - engine/animation/AWait.h - engine/animation/AFunction.h - engine/animation/AAttractToPoint.h - engine/animation/ARotateRelativePoint.h - engine/animation/ARotateLeft.h - engine/animation/Interpolation.cpp - engine/animation/Animations.h - engine/animation/AShowCreation.h - engine/animation/AShowUncreation.h - engine/animation/ARotateLeftUpLookAt.h - engine/animation/ADecompose.h - engine/physics/RigidBody.cpp - engine/physics/RigidBody.h - engine/physics/Simplex.h - engine/physics/HitBox.cpp - engine/physics/HitBox.h - engine/Object.cpp - engine/Object.h - engine/gui/Button.cpp - engine/gui/Button.h - engine/gui/Window.cpp - engine/gui/Window.h - engine/network/ClientUDP.cpp - engine/network/ClientUDP.h - engine/network/MsgType.cpp - engine/network/MsgType.h - engine/network/ReliableMsg.cpp - engine/network/ReliableMsg.h - engine/network/ServerUDP.cpp - engine/network/ServerUDP.h - engine/network/UDPConnection.cpp - engine/network/UDPConnection.h - engine/network/UDPSocket.cpp - engine/network/UDPSocket.h) + 3dzavr/engine/Consts.h + 3dzavr/engine/math/Vec4D.h + 3dzavr/engine/math/Vec4D.cpp + 3dzavr/engine/math/Vec3D.cpp + 3dzavr/engine/math/Vec3D.h + 3dzavr/engine/math/Vec2D.cpp + 3dzavr/engine/math/Vec2D.h + 3dzavr/engine/math/Matrix4x4.h + 3dzavr/engine/math/Matrix4x4.cpp + 3dzavr/engine/Triangle.h + 3dzavr/engine/Triangle.cpp + 3dzavr/engine/math/Plane.h + 3dzavr/engine/math/Plane.cpp + 3dzavr/engine/Mesh.h + 3dzavr/engine/Mesh.cpp + 3dzavr/engine/utils/Log.h + 3dzavr/engine/utils/Log.cpp + 3dzavr/engine/utils/Time.h + 3dzavr/engine/utils/Time.cpp + 3dzavr/engine/utils/Timer.cpp + 3dzavr/engine/utils/Timer.h + 3dzavr/engine/utils/ResourceManager.h + 3dzavr/engine/utils/ResourceManager.cpp + 3dzavr/engine/World.h + 3dzavr/engine/World.cpp + 3dzavr/engine/Camera.h + 3dzavr/engine/Camera.cpp + 3dzavr/engine/io/Screen.h + 3dzavr/engine/io/Screen.cpp + 3dzavr/engine/Engine.h + 3dzavr/engine/Engine.cpp + 3dzavr/engine/io/Keyboard.cpp + 3dzavr/engine/io/Keyboard.h + 3dzavr/engine/io/Mouse.cpp + 3dzavr/engine/io/Mouse.h + 3dzavr/engine/io/SoundController.cpp + 3dzavr/engine/io/SoundController.h + 3dzavr/engine/utils/ObjectController.cpp + 3dzavr/engine/utils/ObjectController.h + 3dzavr/engine/animation/Animation.h + 3dzavr/engine/animation/Timeline.cpp + 3dzavr/engine/animation/Timeline.h + 3dzavr/engine/animation/Interpolation.h + 3dzavr/engine/animation/Animation.cpp + 3dzavr/engine/animation/ATranslate.h + 3dzavr/engine/animation/AScale.h + 3dzavr/engine/animation/ARotate.h + 3dzavr/engine/animation/AWait.h + 3dzavr/engine/animation/AFunction.h + 3dzavr/engine/animation/AAttractToPoint.h + 3dzavr/engine/animation/ARotateRelativePoint.h + 3dzavr/engine/animation/ARotateLeft.h + 3dzavr/engine/animation/Interpolation.cpp + 3dzavr/engine/animation/Animations.h + 3dzavr/engine/animation/AShowCreation.h + 3dzavr/engine/animation/AShowUncreation.h + 3dzavr/engine/animation/ARotateLeftUpLookAt.h + 3dzavr/engine/animation/ADecompose.h + 3dzavr/engine/physics/RigidBody.cpp + 3dzavr/engine/physics/RigidBody.h + 3dzavr/engine/physics/Simplex.h + 3dzavr/engine/physics/HitBox.cpp + 3dzavr/engine/physics/HitBox.h + 3dzavr/engine/Object.cpp + 3dzavr/engine/Object.h + 3dzavr/engine/gui/Button.cpp + 3dzavr/engine/gui/Button.h + 3dzavr/engine/gui/Window.cpp + 3dzavr/engine/gui/Window.h + 3dzavr/engine/network/ClientUDP.cpp + 3dzavr/engine/network/ClientUDP.h + 3dzavr/engine/network/MsgType.cpp + 3dzavr/engine/network/MsgType.h + 3dzavr/engine/network/ReliableMsg.cpp + 3dzavr/engine/network/ReliableMsg.h + 3dzavr/engine/network/ServerUDP.cpp + 3dzavr/engine/network/ServerUDP.h + 3dzavr/engine/network/UDPConnection.cpp + 3dzavr/engine/network/UDPConnection.h + 3dzavr/engine/network/UDPSocket.cpp + 3dzavr/engine/network/UDPSocket.h + ) if(APPLE OR UNIX) include_directories(/usr/local/include) diff --git a/Shooter.cpp b/Shooter.cpp index 620441e..b6b116e 100644 --- a/Shooter.cpp +++ b/Shooter.cpp @@ -5,10 +5,11 @@ #include "Shooter.h" #include #include -#include "engine/animation/Animations.h" +#include "3dzavr/engine/animation/Animations.h" #include "ShooterConsts.h" -#include "engine/io/SoundController.h" +#include "3dzavr/engine/io/SoundController.h" #include "network/Chat.h" + using namespace std; // Read server/client settings and start both. // If client doesn't connect to the localhost - server doesn't start. @@ -51,6 +52,7 @@ void Shooter::initNetwork() { server->generateBonuses(); } + client->requestMap(clientIp, ¤t_map); client->connect(clientIp, clientPort); player->setPlayerNickName(playerName); @@ -67,12 +69,15 @@ void Shooter::initNetwork() { } void Shooter::start() { + // connecting to the server + initNetwork(); + // This code executed once in the beginning: setUpdateWorld(false); screen->setMouseCursorVisible(true); - world->loadMap(ShooterConsts::MAP_OBJ, Vec3D{5, 5, 5}); + world->loadMap(current_map, Vec3D{5, 5, 5}); // TODO: encapsulate call backs inside Player player->setAddTraceCallBack([this](const Vec3D &from, const Vec3D &to) { @@ -93,8 +98,6 @@ void Shooter::start() { player->attach(camera); world->addBody(player); - // connecting to the server - initNetwork(); // Waiting for connect and updating server if it's same window while (client->isWorking() && !client->connected()) { client->update(); @@ -180,7 +183,7 @@ void Shooter::update() { message = message.substr(0, message.size() - 1); } else if (s == (char)27) {//escape - message = ""; //FIXME: неработает потому что isKeyTapped имеют задержку, + message = ""; //FIXME: не работает потому что isKeyTapped имеют задержку, isTypingMessage = false; //т. е. этот код выполняется после нажатия на ESC, } // но при следующем цикле при проверке isKeyTapped(ESC) возвращается TRUE else if (message.length() < ShooterConsts::MAX_MESSAGE_LENGTH && s!=(char)13) {//13=enter